Examples
User documentation
BigRatInterval
is designed to represent (finite, non-empty) intervals
with BigRat
rational end points.
Constructors and pseudo-constructors
BigRatInterval(lwb, upb)
creates an interval with lower end pointlwb
and upper end pointupb
; gives error iflwb > upb
Queries and views
Let I
be a BigRatInterval
min(I)
-- gives the lower end point ofI
max(I)
-- gives the upper end point ofI
width(I)
-- gives the width ofI
as aBigRat
IsZeroInside(I)
-- true iffmin(I) < 0 and max(I) > 0
Operations
Basic interval arithmetic operations between two intervals I1
and I2
:
I1 + I2
I1 - I2
I1 * I2
I1 / I2
gives error ifI2
contains 0merge(I1, I2)
union, but error ifI1
andI2
are disjoint.square(I1)
likeI1*I1
but ensures lower bound is non-negative.soften(I1)
widenI1
to make its end points nicer numbers (PROTOTYPE!)
Basic arithmetic operations between an interval I
and a rational q
:
I + q
andq + I
I - q
andq - I
I * q
andq * I
Division is not yet supported!
Maintainer documentation
I have preferred simplicity over efficiency for this first version.
Bugs, shortcomings and other ideas
Not efficient!
What should the interface to soften
be? Is there a better fn name?
Main changes
2018
- April (v0.99563): first release