Const
Computes the next IEEE floating point representation of v
Interval.round.safeNext(1) // 1.0000000000000002
Interval.round.safeNext(3) // 3.0000000000000004
Interval.round.safeNext(-Infinity) // -Infinity
Computes the previous IEEE floating point representation of v
Interval.round.safePrev(1) // 0.9999999999999999
Interval.round.safePrev(3) // 2.9999999999999996
Interval.round.safePrev(Infinity) // Infinity
Most operations on intervals will cary the rounding error so that the resulting interval correctly represents all the possible values, this feature can be disabled by calling this method allowing a little boost in the performance while operating on intervals
module:interval-arithmetic/round-math.enable
var x = Interval.add(
Interval(1),
Interval(1)
)
x // equal to {lo: 1.9999999999999998, hi: 2.0000000000000004}
Interval.round.disable()
var y = Interval.add(
Interval(1),
Interval(1)
)
y // equal to {lo: 2, hi: 2}
Enables IEEE previous/next floating point wrapping of values (enabled by default)
module:interval-arithmetic/round-math.disable
var x = Interval.add(
Interval(1),
Interval(1)
)
x // equal to {lo: 1.9999999999999998, hi: 2.0000000000000004}
Interval.round.disable()
var y = Interval.add(
Interval(1),
Interval(1)
)
y // equal to {lo: 2, hi: 2}
Interval.round.enable()
var z = Interval.add(
Interval(1),
Interval(1)
)
z // equal to {lo: 1.9999999999999998, hi: 2.0000000000000004}
Generated using TypeDoc
Alias
module:interval-arithmetic/round-math