Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Re: Re: 0**0

by scain (Curate)
on Jan 16, 2003 at 17:54 UTC ( #227432=note: print w/ replies, xml ) Need Help??


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

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


Comment on Re: Re: Re: 0**0
Re: Re: Re: Re: 0**0
by Juerd (Abbot) on Jan 16, 2003 at 18:27 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.

    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

        I assume you've looked in the Perl source code to see how it evaluates 0**0?

        Not really. I don't know C and Perl's source looks like a sendmail configuration file to me. :))

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

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (7)
As of 2014-08-20 09:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (110 votes), past polls