Version: | 0.2-2 |
Date: | 2024-10-09 |
Title: | Functions to Set and Get the IEEE Rounding Mode |
Description: | A pair of functions for getting and setting the IEEE rounding mode for floating point computations. |
URL: | https://github.com/jandom-devel/ieeeround |
License: | GPL-2 | GPL-3 [expanded from: GPL (≥ 2)] |
SystemRequirements: | A C library with the fesetround/fegetround functions. |
OS_type: | unix |
NeedsCompilation: | yes |
Packaged: | 2024-10-10 10:02:51 UTC; amato |
Author: | Gianluca Amato [aut, cre] |
Maintainer: | Gianluca Amato <gianluca.amato@unich.it> |
Repository: | CRAN |
Date/Publication: | 2024-10-10 16:00:02 UTC |
The ieeeround package
Description
These functions get and set the rounding mode for the floating point operations.
Usage
fegetround()
fesetround(rounding.mode = FE.TONEAREST)
FE.DOWNWARD
FE.UPWARD
FE.TOWARDZERO
FE.TONEAREST
Arguments
rounding.mode |
The rounding mode to set. It should be one of |
Details
The rounding mode determines how the result of floating-point operations is treated when the result cannot be exactly represented in the significand. Various rounding modes are provided: round to nearest (the default), round up (towards positive infinity), round down (towards negative infinity), and round towards zero.
fesetround(rounding.mode)
sets the rounding mode and returns 0
if
it was successfull, 1
otherwise.
fegetround()
returns the current rounding mode.
Author(s)
Gianluca Amato amato@sci.unich.it
The fenv.3 Linux manpage maintainers
Examples
fesetround(FE.UPWARD)
x <- 1/5
fesetround(FE.DOWNWARD)
y <- 1/5
print(x-y > 0)
fesetround(FE.TONEAREST)