Rounding JSON decimals into binary formats #
A JSON number is an exact decimal mantissa / 10^exponent. Reading it through
JsonNumber.toFloat and then casting to binary32 rounds twice, and the first rounding is not
directed. The helpers here round the exact decimal once, in the requested direction, directly into
binary32 or binary64.
Certificate parsers use .down for lower endpoints and
.up for upper endpoints, so the parsed box contains the decimal box that the
artifact states. Transcript entries that must equal a replayed value use .nearest.
Round an exact JSON decimal once into fmt.
Instances For
Round an exact JSON decimal once into the executable format fmt.
Instances For
Round an exact JSON decimal once into host binary64.
Instances For
Read a JSON array of exactly n numbers.
Instances For
Read a JSON rows × cols matrix of numbers.
Instances For
Read a length-n JSON vector, rounding every entry once into fmt with mode.
Instances For
Read a rows × cols JSON matrix, rounding every entry once into fmt with mode.