(value: float)
| 300 | |
| 301 | |
| 302 | def _float_text(value: float) -> str: |
| 303 | if math.isnan(value) or math.isinf(value): |
| 304 | raise ValueError("non-finite float cannot convert to string") |
| 305 | if value == 0.0: |
| 306 | return "-0.0" if _is_negative_zero(value) else "0.0" |
| 307 | text = _plain_decimal_text(decimal.Decimal.from_float(value)) |
| 308 | if "." not in text: |
| 309 | return f"{text}.0" |
| 310 | text = text.rstrip("0") |
| 311 | if text.endswith("."): |
| 312 | text += "0" |
| 313 | return text |
| 314 | |
| 315 | |
| 316 | def _string_value(value) -> str: |
no test coverage detected