chickadee » srfi-278 » rationalize

rationalize x yprocedure
rationalize x delta-lower delta-upper #!optional lower-inclusive? upper-inclusive?procedure

When not supplied, lower-inclusive? and upper-inclusive? default to #t.

This procedure is like rationalize in the R7RS. When delta-lower and delta-upper are specified, then the simplest rational between x−|delta-lower| and x+|delta-upper| is returned.

When lower-inclusive? is true, the lower bound of the range is inclusive; otherwise, it is exclusive. When upper-inclusive? is true, the upper bound of the range is inclusive; otherwise, it is exclusive. For example, (rationalize x -1 +1 #f #t) covers the range (x−1,x+1].