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
<https://en.wikipedia.org/wiki/Continued_fraction> can represent any quadratic
root
<http://www.millersville.edu/~bikenaga/number-theory/periodic-continued-fractions/periodic-continued-fractions.html>.
Haskel has this package implementing a quadratic irrational type
<https://hackage.haskell.org/package/quadratic-irrational-0.0.2/docs/Numeric-QuadraticIrrational.html>,
and it can translate between those and continued fractions. ... here is a
decent intro to continued fractions
<http://www.maths.surrey.ac.uk/hosted-sites/R.Knott/Fibonacci/cfINTRO.html>.

That's a comprehensive answer for square roots of rationals, but not
for transcendental
numbers <http://sprott.physics.wisc.edu/pickover/trans.html>. My math is
not so hot, but perhaps a generalized continued fraction
<https://en.wikipedia.org/wiki/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
<https://cloud.sagemath.com/projects/3966ff36-7109-449d-83a9-49e48e078fea/files/2015-06-22-133206.sagews>
.

-y

Reply via email to