Previous Up Next

9.4.7  Rational approximation

Floating point numbers are considered approximations, while integers and rational numbers are considered exact. The float2rational or exact command finds a rational approximation to a floating point number.

Examples

float2rational(1.5)
     
3
2
          
float2rational(1.414)
     
707
500
          
float2rational(0.156381102937*2)
     
5144
16447
          
float2rational(1.41421356237)
     
114243
80782
          
float2rational(1.41421356237^2)
     
2           

Previous Up Next