DoubleScrewdriver extension
Provides extensions for double.
- on
Methods
-
isCloseTo(
double other, {double precision = 1.0e-8}) → bool -
Returns true if this is close to
other
withinprecision
. By default,precision
is set to 1.0e-8 which is 0.00000001 which makes it suitable for most of the cases. -
roundToPrecision(
int nthPosition) → double -
Rounds value
precision
number of fraction points. Example: 2.1234567890.roundToPrecision(0)=> 2 2.1234567890.roundToPrecision(1)=> 2.1 2.1234567890.roundToPrecision(2)=> 2.12 2.1234567890.roundToPrecision(3)=> 2.123