#!/usr/bin/perl use strict; use warnings; sub exp_ { my $x = shift; my ($d, $ret, $i) = (1.0, 1); while ($ret - $d != $ret) { $d *= $x/++$i; $ret += $d; } return $ret; } for (1..100) { print "exp($_) = ".exp_($_)."\n"; }
In reply to Re: Exponential Function Programming
by pajout
in thread Exponential Function Programming
by Abulil
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |