in reply to Re^2: 0**0
in thread order of arguments evaluated

Perhaps I'm missing the point - could you elaborate further how that relates to Perl?

Think about 0**0. What should that value be? You can devise arguments that it could be either 0 or 1 (i.e. $anything**0==1 but 0*$anything==0)

0**0 (in perl) equals 0^0 (in exponent notation) equals 1

Any number computed to the exponent of 0 is 1. Perl behaves this way.

if (eval(0**0)){print "JAPH\n";}

The math article noted would seem to support that assertion as well. While there are speculative comments to the contrary towards the beginning of the article, the citations noted in following instead support this idea again.

How is this ugly? It seems to be clearly defined. Is that the issue? Would you prefer to be able to configure it depending on the job? Is this like trying to ban guns to keep people from shooting themselves in the foot or are we offering them telescopic sighting mechanisms so they can shoot only the offending toe?



Wait! This isn't a Parachute, this is a Backpack!

Replies are listed 'Best First'.
Re^4: 0**0
by Anonymous Monk on May 31, 2005 at 20:50 UTC
    It is ugly because it is ambiguous, convention not withstanding. You can artifically declare one interpretation to be the preferred one, but it will still be artificial. Here's a program for you to run...
    #!/usr/bin/perl -w print "\n n| n^0.1 n^0.01 n^0.001 etc...\n"; print ("--+".("-" x 70)."\n"); for my $num (reverse 0..10) { printf "%2d| ", $num; for my $exp (1..10) { printf "%5.4f ", $num ** (10**(-$exp)); } print "\n"; }
    Notice any tendencies? Is the case for zero different in any way? Explain.
    n| n^0.1 n^0.01 n^0.001 etc... --+------------------------------------------------------------------ 10| 1.2589 1.0233 1.0023 1.0002 1.0000 1.0000 1.0000 1.0000 1.0000 9| 1.2457 1.0222 1.0022 1.0002 1.0000 1.0000 1.0000 1.0000 1.0000 8| 1.2311 1.0210 1.0021 1.0002 1.0000 1.0000 1.0000 1.0000 1.0000 7| 1.2148 1.0196 1.0019 1.0002 1.0000 1.0000 1.0000 1.0000 1.0000 6| 1.1962 1.0181 1.0018 1.0002 1.0000 1.0000 1.0000 1.0000 1.0000 5| 1.1746 1.0162 1.0016 1.0002 1.0000 1.0000 1.0000 1.0000 1.0000 4| 1.1487 1.0140 1.0014 1.0001 1.0000 1.0000 1.0000 1.0000 1.0000 3| 1.1161 1.0110 1.0011 1.0001 1.0000 1.0000 1.0000 1.0000 1.0000 2| 1.0718 1.0070 1.0007 1.0001 1.0000 1.0000 1.0000 1.0000 1.0000 1| 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 0| 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
Re^4: 0**0
by Anonymous Monk on Jun 02, 2005 at 16:38 UTC