nebius/SWE-bench-extra huggingface dataset:
Repository: airspeed-velocity/asv

Issue:
util.human_float doesn't print +-inf or nan properly
Raises exceptions in `math.log10`:
```
  File "asv/util.py", line 110, in human_float
    logv = math.log10(value)
ValueError: math domain error
```
on +/-inf or nan inputs.

This can be triggered in `asv show` and maybe elsewhere.

Comments:

Patch:
diff --git a/asv/util.py b/asv/util.py
index c7a58e7..42688af 100644
--- a/asv/util.py
+++ b/asv/util.py
@@ -106,6 +106,13 @@ def human_float(value, significant=3, truncate_small=None, significant_zeros=Fal
     """
     if value == 0:
         return "0"
+    elif math.isinf(value) or math.isnan(value):
+        return "{}".format(value)
+    elif value < 0:
+        sign = "-"
+        value = -value
+    else:
+        sign = ""
 
     logv = math.log10(value)
     magnitude = int(math.floor(logv)) + 1
@@ -127,7 +134,7 @@ def human_float(value, significant=3, truncate_small=None, significant_zeros=Fal
     else:
         fmt = "{{0:.{0}f}}".format(num_digits)
 
-    formatted = fmt.format(value)
+    formatted = sign + fmt.format(value)
 
     if not significant_zeros and '.' in formatted and 'e' not in fmt:
         formatted = formatted.rstrip('0')


Test patch:
diff --git a/test/test_util.py b/test/test_util.py
index 364bcf2..ccd8832 100644
--- a/test/test_util.py
+++ b/test/test_util.py
@@ -192,6 +192,17 @@ def test_human_float():
         ("0", 0.001, 2, 0),
         ("0", 0.001, 2, 1),
         ("0.001", 0.001, 2, 2),
+
+        # non-finite
+        ("inf", float('inf'), 1),
+        ("-inf", -float('inf'), 1),
+        ("nan", float('nan'), 1),
+
+        # negative
+        ("-1", -1.2345, 1),
+        ("-0.00100", -0.001, 3, None, True),
+        ("-0", -0.001, 2, 1),
+        ("-0.001", -0.001, 2, 2),
     ]
 
     for item in items:
Repository: airspeed-velocity/asv

Issue:
Left sidepanel benchmark list wrong
The left-sidepanel benchmark list tree is not constructed correctly: items appear several times
https://pv.github.io/numpy-bench/#bench_function_base.Where.time_2_broadcast

Comments:

Patch:
diff --git a/asv/util.py b/asv/util.py
index c7a58e7..42688af 100644
--- a/asv/util.py
+++ b/asv/util.py
@@ -106,6 +106,13 @@ def human_float(value, significant=3, truncate_small=None, significant_zeros=Fal
     """
     if value == 0:
         return "0"
+    elif math.isinf(value) or math.isnan(value):
+        return "{}".format(value)
+    elif value < 0:
+        sign = "-"
+        value = -value
+    else:
+        sign = ""
 
     logv = math.log10(value)
     magnitude = int(math.floor(logv)) + 1
@@ -127,7 +134,7 @@ def human_float(value, significant=3, truncate_small=None, significant_zeros=Fal
     else:
         fmt = "{{0:.{0}f}}".format(num_digits)
 
-    formatted = fmt.format(value)
+    formatted = sign + fmt.format(value)
 
     if not significant_zeros and '.' in formatted and 'e' not in fmt:
         formatted = formatted.rstrip('0')
diff --git a/asv/www/graphdisplay.js b/asv/www/graphdisplay.js
index 3d6446c..b0d80e4 100644
--- a/asv/www/graphdisplay.js
+++ b/asv/www/graphdisplay.js
@@ -147,9 +147,13 @@ $(document).ready(function() {
         var cursor = [];
         var stack = [tree];
 
-        /* Note: this relies on the fact that the benchmark names are
-           sorted. */
-        $.each($.asv.master_json.benchmarks, function(bm_name, bm) {
+        /* Sort keys for tree construction */
+        var benchmark_keys = Object.keys($.asv.master_json.benchmarks);
+        benchmark_keys.sort();
+
+        /* Build tree */
+        $.each(benchmark_keys, function(i, bm_name) {
+            var bm = $.asv.master_json.benchmarks[bm_name];
             var parts = bm_name.split('.');
             var i = 0;
             var j;


Test patch:
diff --git a/test/test_util.py b/test/test_util.py
index 364bcf2..ccd8832 100644
--- a/test/test_util.py
+++ b/test/test_util.py
@@ -192,6 +192,17 @@ def test_human_float():
         ("0", 0.001, 2, 0),
         ("0", 0.001, 2, 1),
         ("0.001", 0.001, 2, 2),
+
+        # non-finite
+        ("inf", float('inf'), 1),
+        ("-inf", -float('inf'), 1),
+        ("nan", float('nan'), 1),
+
+        # negative
+        ("-1", -1.2345, 1),
+        ("-0.00100", -0.001, 3, None, True),
+        ("-0", -0.001, 2, 1),
+        ("-0.001", -0.001, 2, 2),
     ]
 
     for item in items: