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')

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.
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:

pip install -e .[dev]
parse_log_pytest
requirements.txt
pytest
3.6
pip_requirements.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
alabaster==0.7.13
-e git+https://github.com/airspeed-velocity/asv.git@d069dc4a375a60402acc0bbe1b7df938768b0c16#egg=asv
attrs==22.2.0
Babel==2.11.0
certifi==2021.5.30
charset-normalizer==2.0.12
docutils==0.18.1
idna==3.10
imagesize==1.4.1
importlib-metadata==4.8.3
iniconfig==1.1.1
Jinja2==3.0.3
MarkupSafe==2.0.1
packaging==21.3
pluggy==1.0.0
py==1.11.0
Pygments==2.14.0
pyparsing==3.1.4
pytest==7.0.1
pytz==2025.2
requests==2.27.1
six==1.17.0
snowballstemmer==2.2.0
Sphinx==5.3.0
sphinx-bootstrap-theme==0.8.1
sphinxcontrib-applehelp==1.0.2
sphinxcontrib-devhelp==1.0.2
sphinxcontrib-htmlhelp==2.0.0
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-serializinghtml==1.1.5
tomli==1.2.3
typing_extensions==4.1.1
urllib3==1.26.20
zipp==3.6.0

name: asv
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2021.5.30=py36h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.3=he6710b0_2
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - pip=21.2.2=py36h06a4308_0
  - python=3.6.13=h12debd9_1
  - readline=8.2=h5eee18b_0
  - setuptools=58.0.4=py36h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - wheel=0.37.1=pyhd3eb1b0_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - alabaster==0.7.13
      - attrs==22.2.0
      - babel==2.11.0
      - charset-normalizer==2.0.12
      - docutils==0.18.1
      - idna==3.10
      - imagesize==1.4.1
      - importlib-metadata==4.8.3
      - iniconfig==1.1.1
      - jinja2==3.0.3
      - markupsafe==2.0.1
      - packaging==21.3
      - pluggy==1.0.0
      - py==1.11.0
      - pygments==2.14.0
      - pyparsing==3.1.4
      - pytest==7.0.1
      - pytz==2025.2
      - requests==2.27.1
      - six==1.17.0
      - snowballstemmer==2.2.0
      - sphinx==5.3.0
      - sphinx-bootstrap-theme==0.8.1
      - sphinxcontrib-applehelp==1.0.2
      - sphinxcontrib-devhelp==1.0.2
      - sphinxcontrib-htmlhelp==2.0.0
      - sphinxcontrib-jsmath==1.0.1
      - sphinxcontrib-qthelp==1.0.3
      - sphinxcontrib-serializinghtml==1.1.5
      - tomli==1.2.3
      - typing-extensions==4.1.1
      - urllib3==1.26.20
      - zipp==3.6.0
prefix: /opt/conda/envs/asv

test/test_util.py::test_human_float
test/test_util.py::test_parallelfailure test/test_util.py::test_write_unicode_to_ascii test/test_util.py::test_which_path test/test_util.py::test_write_load_json test/test_util.py::test_human_time test/test_util.py::test_human_file_size test/test_util.py::test_is_main_thread test/test_util.py::test_json_non_ascii test/test_util.py::test_interpolate_command test/test_util.py::test_datetime_to_js_timestamp test/test_util.py::test_datetime_to_timestamp
asv/util.py
asv/util.py