On Dec 16, 2003, at 7:16 AM, Rob Dixon wrote: [..]
Rob

  use strict;
  use warnings;

use Math::Fraction;

  for (my $value = frac -1; $value <= 1; $value += 0.1) {
    print $value->decimal, "\n";
  }
[..]

neat solution, minor problem is that Math::Fraction
is not a 'default' module yet.

<http://search.cpan.org/~kevina/Fraction-v.53b/Fraction.pm>

An interum work around for the IEEE754 float problem of "-0.0"
would of course be to test and remove it:

        for (my $value = -1; $value <= 1; $value += 0.1)
        {
                my $number = sprintf "%.1f", $value;
                $number = 0 if ( $number == 0 );

        print "$number\n";
        }



ciao
drieux

---


-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to