Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Re: 0**0

by Juerd (Abbot)
on Jan 16, 2003 at 17:26 UTC ( [id://227424]=note: print w/replies, xml ) Need Help??


in reply to Re: 0**0
in thread 0**0

This is perl, version 4.0

Thanks, but my code won't run with Perl 4 anyway. Have you got Perl 5 installed on that box? If it doesn't work, I'll have to avoid using 0**0 in my code.

Juerd
- http://juerd.nl/
- spamcollector_perlmonks@juerd.nl (do not use).

Replies are listed 'Best First'.
Re: Re: Re: 0**0
by krujos (Curate) on Jan 16, 2003 at 19:28 UTC
    jkruck:<rue> % uname -srvm HP-UX B.11.00 U 9000/800 jkruck:<rue> % perl -v This is perl, version 5.005_03 built for PA-RISC1.1 Copyright 1987-1999, Larry Wall Perl may be copied only under the terms of either the Artistic License + or the GNU General Public License, which may be found in the Perl 5.0 source +kit. Complete documentation for Perl, including FAQ lists, should be found +on this system using `man perl' or `perldoc perl'. If you have access to + the Internet, point your browser at http://www.perl.com/, the Perl Home Pa +ge. jkruck:<rue> % perl -wle 'print 0**0' 1
Re: Re: Re: 0**0
by scain (Curate) on Jan 16, 2003 at 17:54 UTC
    Clearly, if you are doing some numerical analysis, and you know in your case that 0**0 = 1 is not the right way to go, you absolutely should be checking for zeroes and handling them appropriately.

    Scott
    Project coordinator of the Generic Model Organism Database Project

      Clearly, if you are doing some numerical analysis, and you know in your case that 0**0 = 1 is not the right way to go, you absolutely should be checking for zeroes and handling them appropriately.

      I need it to be 1. The question is if Perl will always say 0**0 is 1, or if it does something different on other platforms. Because even mathematicians can't agree on what 00 should be, I wonder if Perl will always deal with it in the same way, or depending on system configuration.

      Juerd
      - http://juerd.nl/
      - spamcollector_perlmonks@juerd.nl (do not use).
      

        Yes, I was somewhat disturbed by what Abigail-II reported for Perl 4; one would hope for consistency. I assume you've looked in the Perl source code to see how it evaluates 0**0? I would guess that it uses the operating system's math tools. I guess you are going to have to check for zeroes anyway, and set the value as an exception to be safe. Ugly, but it should work.

        Scott
        Project coordinator of the Generic Model Organism Database Project

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://227424]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2024-04-18 23:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found