(d)
| 7 | |
| 8 | |
| 9 | def floatToGoString(d): |
| 10 | d = float(d) |
| 11 | if d == INF: |
| 12 | return '+Inf' |
| 13 | elif d == MINUS_INF: |
| 14 | return '-Inf' |
| 15 | elif math.isnan(d): |
| 16 | return 'NaN' |
| 17 | else: |
| 18 | s = repr(d) |
| 19 | dot = s.find('.') |
| 20 | # Go switches to exponents sooner than Python. |
| 21 | # We only need to care about positive values for le/quantile. |
| 22 | if d > 0 and dot > 6: |
| 23 | mantissa = f'{s[0]}.{s[1:dot]}{s[dot + 1:]}'.rstrip('0.') |
| 24 | return f'{mantissa}e+0{dot - 1}' |
| 25 | return s |
| 26 | |
| 27 | |
| 28 | def parse_version(version_str: str) -> tuple[Union[int, str], ...]: |
no test coverage detected