note
fizbin
<blockquote>I've never been able to work out an algorithm for calculating exp for rationals.</blockquote>
That's probably because <c>exp(r)</c> is irrational for every rational <c>r</c> except for 0. However, saying <c>use bigrat</c> sprinkles some magic crazy dust over the whole program in a way similar to <c>use bignum</c>; witness:
<code>
use bigrat;
use strict;
my $lnev = - 7 / (10 ** 17);
print "lnev is $lnev\n";
my $ev = exp($lnev);
print "ev is $ev\n";
print "1-ev is ", 1-$ev, "\n";
</code>
Again, both values are 1.
<!-- Node text goes above. Div tags should contain sig only -->
<div class="pmsig"><div class="pmsig-246930">
--<br>
<code>@/=map{[/./g]}qw/.h_nJ Xapou cets krht ele_ r_ra/;
map{y/X_/\n /;print}map{pop@$_}@/for@/</code>
</div></div>
534734
534846