up previous next
SimplestBinaryRatBetween

find simplest binary rational in a closed interval

Syntax
SimplestBinaryRatBetween(A: RAT, B: RAT): RAT

Description
This function finds the simplest binary rational in the closed interval with end points A and B . We define the simplest binary rational to be the rational number of the form N*2^k where the integer N has the smallest possible absolute value. See also SimplestRatBetween.

Example
/**/  SimplestBinaryRatBetween(0.123, 0.456);
1/4

/**/  SimplestBinaryRatBetween(-3.14159, -2.71828);
-3

/**/  SimplestBinaryRatBetween(5,10); // contrast with SimplestRatBetween!
8

See Also