3 ms·
Check out my other comment below. Factor has with-rounding-mode and you can nest these modes. Example: +round-up+ [ 1.0 3.0 /f double>bits .h
by gre 12y ago
Check out my other comment below. Factor has with-rounding-mode and you can nest these modes.
Example:
+round-up+ [
1.0 3.0 /f double>bits .h
+round-zero+ [
1.0 3.0 /f double>bits .h
] with-rounding-mode
] with-rounding-mode
! output
! 3fd5555555555556
! 3fd5555555555555
- andrioni 12y agoJulia also supports this: with_rounding(Float64, RoundUp) do println(bits(1.0 / 3.0)) with_rounding(Float64, RoundToZero) do println(bits(1.0 / 3.0)) end end 0011111111010101010101010101010101010101010101010101010101010110 0011111111010101010101010101010101010101010101010101010101010101