[GAP Forum] parse rational number

Alexander Hulpke hulpke at math.colostate.edu
Mon Nov 23 17:05:54 GMT 2009



Dear forum, Dear Nasira Sindhu,

> is there any function in GAP, which parses a rational number like 66/123 in a floating point number like 0.536 ? 
The command `EvalF' returns a string containing a floating point representation of a rational number.
For example:
gap> EvalF(1/81);
"0.0123456790"
gap> EvalF(1/81,50);
"0.01234567901234567901234567901234567901234567901234"

Please be aware that the only thing you can do with these strings is human display -- there is no arithmetic functionality.

Regards,

    Alexander Hulpke

-- Colorado State University, Department of Mathematics,
Weber Building, 1874 Campus Delivery, Fort Collins, CO 80523-1874, USA
email: hulpke at math.colostate.edu, Phone: ++1-970-4914288
http://www.math.colostate.edu/~hulpke






More information about the Forum mailing list