[Haskell-cafe] Why is toRational a method of Real?
Alexander Solla
ajs at 2piix.com
Wed Aug 4 14:36:39 EDT 2010
On Aug 4, 2010, at 11:30 AM, Omari Norman wrote:
> Why is toRational a method of Real? I thought that real numbers need
> not
> be rational, such as the square root of two. Wouldn't it make more
> sense
> to have some sort of Rational typeclass with this method? Thanks.
You can't build the real number field using a computer. So you have
to turn what "should" be a real into something you can express on a
computer. You can either choose to use the field of "computable real
numbers", which is slow, or you can just go with a "near enough"
rational approximation.
More information about the Haskell-Cafe
mailing list