Crate xenon

Source
Expand description

§Fixed-point math, for any static or dynamic precision in any base.

Differences from floating-point:

  • exact results, except where explicitly rounded
  • supports rounding in any base, such as decimal
  • simpler interface (no NaN, infinities)
  • better performance
  • more compact storage for some value ranges
  • unnormalized, so sigfigs of result can be determined by sigfigs of inputs

Differences from bignums:

  • if you know the “shape” of your inputs/calculations, the statically typed fixed-points can be more efficient
  • XeN is optimized for values that fit in a relatively small range

§Dynamic precision? Isn’t that floating point?

Technically yes, but the Xe API is much simpler than typical floating point; it’s designed for applications like working with a collection of values that are known to be fixed-precision decimal of the same type, but the number of decimal places won’t be known until runtime.

Structs§

F64
Xe

Traits§

ToIsize

Type Aliases§

Xe0
Xe1
Xe2
Xe3
Xe4
Xe5
Xe6
Xe7
Xe8
Xe9
Xe10
Xe11
Xe12
Xe13
Xe14
Xe15
XeN
XeNS