Scaling utilities.
Often, in order to avoid underflow, we can offload some of the exponent of a double into an int. To make things more efficient, we can actually share that exponent between doubles.
The scales used in this trait are in log space: they can be safely added and subtracted.
- Companion
- object
Value members
Concrete methods
Computes the log power of two we'd need to scale by so that the max double is between (2 ** scaleConstant, 2 ** -scaleConstant).
Computes the log power of two we'd need to scale by so that the max double is between (2 ** scaleConstant, 2 ** -scaleConstant).
Ensures that the max double is between (2scaleConstant,2-scaleConstant), scaling the array as necessary.
Ensures that the max double is between (2scaleConstant,2-scaleConstant), scaling the array as necessary.
- Returns
newScale
Sums src
into dest
assuming they're at different scales. src
may be longer than
dest
, which is useful for allocating a large work buffer.
Sums src
into dest
assuming they're at different scales. src
may be longer than
dest
, which is useful for allocating a large work buffer.
- Returns
the new scale