Forums before death by AOL, social media and spammers... "We can't have nice things"
|    comp.lang.c++.moderated    |    Moderated discussion of C++ superhackery    |    33,346 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 33,215 of 33,346    |
|    Jyoti Sharma to Thomas Richter    |
|    Re: How is 0^0 handled by C++?    |
|    27 Sep 13 23:09:05    |
   
   From: jyoti.mickey@googlemail.com   
      
   On 9/28/2013 4:23 AM, Thomas Richter wrote:   
   > On 27.09.2013 20:41, Dan_Christensen@sympatico.ca wrote:   
   >> I am not a C++ developer, but I have a passing familiarity with   
   >> the language. I would like to know how 0^0 is handled by C++   
   >> applications in scientific and engineering applications. Does   
   >> having 0^0=1 ever cause any "real-world" problems?   
   >   
   > First of all, "^" is the bitwise exclusive-or operator in C++, not the   
   > power function. To my knowledge, the pow(,) function is defined such   
   > that the function returns 1.0 if the second argument is zero, no matter   
   > what the first argument is, even if it is a NAN. I personally haven't   
   > run into situations where this was either necessary or a problem, but I   
   > haven't used pow() a lot. In my applications, if I ever use pow, the   
   > second argument is a (non-integer) constant.   
   >   
   > { Fact: pow(x, y) is specified so that a domain error may occur   
   > if both x and y are zero. -mod/sk }   
      
   { quoted greetings removed -mod }   
      
   It depends on your contextual requirement. If we wanted continuity at   
   pow(0,0) we require it to be 1. Taylor series expansion also require it   
   to be 1. bcc55 gave "DOMAIN error" and g++ gave 1. I prefer 1.   
      
   Greetings,   
   Jyoti Sharma   
      
      
   --   
    [ See http://www.gotw.ca/resources/clcm.htm for info about ]   
    [ comp.lang.c++.moderated. First time posters: Do this! ]   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca