|
NumericAL
A header-only C++20 lexer built on REAL
|
A real of type R rounded to decimals places, half to even, as numpy.round: nearbyint(x · 10ᵈ) / 10ᵈ (nearbyint(x / 10⁻ᵈ) · 10⁻ᵈ for a negative d), computed in C.
More...
#include <tensor_ops.hpp>
Public Member Functions | |
| decimal_rounding (int places) noexcept | |
| R | operator() (R x) const noexcept |
Public Attributes | |
| int | decimals |
| The places; fewer than none round to tens, hundreds and so on. | |
| C | scale |
10 to the magnitude of decimals, in C. | |
| C | exact_from |
| The magnitude from which a value is its own rounding (decimals above 0). | |
A real of type R rounded to decimals places, half to even, as numpy.round: nearbyint(x · 10ᵈ) / 10ᵈ (nearbyint(x / 10⁻ᵈ) · 10⁻ᵈ for a negative d), computed in C.
An x of magnitude 2ᵖ · 10⁻ᵈ or more (p the digits of R's significand) has an ulp coarser than the places: its decimal rounding lies within half a place of it, nearer than any other value, so it is kept. Its product by 10ᵈ, which NumPy's computes, can round off its last bit or overflow (round(1e307, 2)); below, the product is under 2ᵖ. A finite x rounds to ±0 where 10⁻ᵈ overflows C.
Definition at line 2923 of file tensor_ops.hpp.
|
inlineexplicitnoexcept |
Definition at line 2928 of file tensor_ops.hpp.
|
inlinenoexcept |
Definition at line 2934 of file tensor_ops.hpp.
| int numerical::detail::decimal_rounding< R, C >::decimals |
The places; fewer than none round to tens, hundreds and so on.
Definition at line 2924 of file tensor_ops.hpp.
| C numerical::detail::decimal_rounding< R, C >::exact_from |
The magnitude from which a value is its own rounding (decimals above 0).
Definition at line 2926 of file tensor_ops.hpp.
| C numerical::detail::decimal_rounding< R, C >::scale |
10 to the magnitude of decimals, in C.
Definition at line 2925 of file tensor_ops.hpp.