Rounding is:module

Rounding rationals to significant digits and decimal places. The round function from the prelude returns an integer. The standard librarys of C and C++ have round functions that return floating point numbers. Rounding in this library takes and returns Rationals and can round to a number of significant digits or a number of decimal places.
This module provides various combinations of explicit floating point operations. The are three supported rounding variants:
  • ceil (rounding towards positive infinity)
  • floor (rounding towards negative infinity)
  • truncate (rounding towards zero)
Operators:
  • + add
  • - subtract
  • * multiplicate
  • / divide
  • sqrt squareRoot
  • id converting numbers between formats
The floating point data types: The behaviour for NaNs is very hardware dependent. In case an operation would result in a NaN the corresponding round-to-nearest-even-on-tie variant is used to get the result.