pdft.io.format_float_julia_like

pdft.io.format_float_julia_like#

pdft.io.format_float_julia_like(x)[source]#

Format a Python float the way Julia’s string(x::Float64) does.

Python and Julia agree on decimal forms (“1.0”, “3.14”, “-0.0”) and on the base algorithm (shortest round-trip representation). They differ in scientific notation:

Python repr Julia string ———— ———— 5e-07 5.0e-7 ← Julia always has ‘.0’ in mantissa 1e+20 1.0e20 ← Julia drops ‘+’ from positive exponent 1.5e-07 1.5e-7 ← Julia drops leading zero in exponent

We produce Julia’s form by post-processing Python’s repr. Used by JSON serialization (basis_to_dict) and by external benchmark code that needs to write Julia-byte-compatible numeric strings.

Return type:

str