def F32.shortest
import bend-kit-fmt@0.1.0.0/fmt.bend as Fmtimport Base
459# The shortest decimal that reads back to x, with ".0" on whole numbers.
460def F32.shortest(x: F32) -> String:
461 +b = {Short.bits(x) : U32}
462 +ex = {U32.and(U32.shrn(b, 23n), 255) : U32}
463 +mant = {U32.and(b, 8388607) : U32}
464 Short.go(U32.is_eq(ex, 255), Bool.and(U32.is_zero(ex), U32.is_zero(mant)),
465 U32.is_ge(b, 2147483648), ex, mant)
Uses (11)
Used by (0)
No other definition uses this definition.