On Sat, 11 Nov 2006 16:34:55 -0800, Chip Salzenberg (via RT) wrote

> because the Perl sprintf test suite seems to think that the right value
> for sprintf('%e',1) is "1e+00", but Win32 seems to return "1e+000" (note
> the extra digit in the exponent).  Is this true?  If so, is it a bug? In 
> any case, how does the Perl test suite not fail on Win32?

It just drops the superfluous zero from the return value.
Even if sprintf(">%e<", 1234.875) on win32 returns ">1.234875e+003<"
here $y is ">1.234875e+03<" that comes to be equal to ">$result<".
In this way these three-digit exponents are accepted.

# Cf. perl-current/t/op/sprintf.t
    $x = sprintf(">$template<", @$data);
    substr($x, -1, 0) = $w if $w;
    # $x may have 3 exponent digits, not 2
    my $y = $x;
    if ($y =~ s/([Ee][-+])0(\d)/$1$2/) {
..........
    }
..........
    if ($x eq ">$result<") {
        print "ok $i\n";
    }
    elsif ($skip) {
        print "ok $i # skip $comment\n";
    }
    elsif ($y eq ">$result<")   # Some C libraries always give
    {                           # three-digit exponent
                print("ok $i # >$result< $x three-digit exponent accepted\n");
    }

Regards,
SADAHIRO Tomoyuki


Reply via email to