Thinking over my programming career, there were a few occasions I had to
spend time working around floating point errors, and it was a nuisance.
There were even fewer times when I worked with transcendental numbers-
programs dealing with geometry or tones or logarithmic scales- and those
times, floating point was good enough.

Which is to say, Perl 6's Rats would have solved my nuisance issues, and I
would not have appreciated exact types for irrational numbers in my tasks
to date.

Still, I couldn't resist thinking about them and web-searching on them a
bit more, and here's my brain-dump. Periodic continued fractions
<> can represent any quadratic
Haskel has this package implementing a quadratic irrational type
and it can translate between those and continued fractions. ... here is a
decent intro to continued fractions

That's a comprehensive answer for square roots of rationals, but not
for transcendental
numbers <>. My math is
not so hot, but perhaps a generalized continued fraction
<> type could
perfectly represent transcendental constants like pi and e, with trig and
log/exponentiation functions using them. Then Perl 6 could get this famous
relationship *exactly right*:

say 1 + e ** (pi * i)

... though I suspect it really does take a symbolic math package to get all
combinations of the trig & exponential functions right


Reply via email to