Skip to main content

Module float

Module float 

Source
Expand description

repr of a float, which is not what any Rust format specifier produces.

Rust prints 1e30 as thirty digits and 1.0 as 1. CPython picks between fixed and exponential notation on the position of the decimal point, pads the exponent to two digits, and always signs it. The digits themselves are the same in both languages, the shortest string that reads back as the same double, so {:e} supplies them and only the presentation is redone here.

Enums§

DotZero
Whether a float with no fractional part keeps a trailing .0.

Functions§

float_repr
repr of a float, with dot_zero deciding the trailing .0.