Page 1 of 1

Pow(-1, Infinity()) - what are your results?

Posted: Sun Sep 09, 2012 6:30 pm
by DarkDragon
Hello,

I know this is a PureBasic forum, but I need to try this, as PureBasic uses C functions. Maybe you can help me understanding this situation through executing this C code on your machine:

Code: Select all

#include <stdio.h>
#include <math.h>

int main(int argc, char** argv)
{
  double zero = 0.0;
  double infinity = 1.0 / zero;
  
  printf("%f\n", pow(-1.0, infinity));
  printf("%f\n", pow(-2.0, infinity));
  printf("%f\n", pow(-1.0, -infinity));
  printf("%f\n", pow(-2.0, -infinity));
  printf("%f\n", pow(infinity, infinity));
  printf("%f\n", pow(-infinity, infinity));
  printf("%f\n", pow(infinity, -infinity));
  printf("%f\n", pow(-infinity, -infinity));
  
  return 0;
}
I already got some results, but no NaNs yet. It would be nice if you could tell me the operating system (also the version), your exact processor name, the processor type (amd64, x86, ...) and the compiler like here:
Intel Q6600 - Windows 7 (amd64, compiled with mingw-64):
1.000000
1.#INF00
1.000000
0.000000
1.#INF00
1.#INF00
0.000000
0.000000

AMD Phenom II X4 955 - Windows 7 (amd64, compiled with mingw-64):
1.000000
1.#INF00
1.000000
0.000000
1.#INF00
1.#INF00
0.000000
0.000000

Intel Core 2 Duo - Windows Vista (x86, compiled with mingw-32):
1.000000
1.#INF00
1.000000
0.000000
1.#INF00
1.#INF00
0.000000
0.000000

Intel Atom CPU 230 - Debian (x86, compiled with gcc):
1.000000
inf
1.000000
0.000000
inf
inf
0.000000
0.000000
Thanks for any responses.

[EDIT]
Here you can get the binaries: http://www.bradan.eu/files/test_binaries.zip.

Re: Pow(-1, Infinity()) - what are your results?

Posted: Sun Sep 09, 2012 6:46 pm
by Shield
Intel Core i7 M620 2.67GHz Windows 7 x64

Code: Select all

1.000000
1.#INF00
1.000000
0.000000
1.#INF00
1.#INF00
0.000000
0.000000

Re: Pow(-1, Infinity()) - what are your results?

Posted: Sun Sep 09, 2012 7:52 pm
by jack
Intel(R) Xeon X5650 gcc 4.2.1 on Mac OS X
1.000000
inf
1.000000
0.000000
inf
inf
0.000000
0.000000
-----------------
Intel(R) Xeon X5650 gcc 2.95 on Windows 7-32
1.000000
1.#INF00
-1.#IND00
0.000000
1.#INF00
1.#INF00
0.000000
0.000000
-----------------
Intel(R) Xeon X5650 VS 2008 on Windows 7-32
1.000000
1.#INF00
1.000000
0.000000
1.#INF00
1.#INF00
0.000000
0.000000
-----------------
Intel(R) Xeon X5650 VS 2010 on Windows 7-32
1.000000
1.#INF00
1.000000
0.000000
1.#INF00
1.#INF00
0.000000
0.000000

Re: Pow(-1, Infinity()) - what are your results?

Posted: Mon Sep 10, 2012 5:55 am
by DarkDragon
Thanks for your answers. I've uploaded a few binaries which could be helpful: http://www.bradan.eu/files/test_binaries.zip.

@jack: it would be nice if you could write your exact windows version (xp, vista, 7, ...) to your results to be sure that the windows version doesn't matter.

Re: Pow(-1, Infinity()) - what are your results?

Posted: Mon Sep 10, 2012 6:19 am
by KJ67
It may have to do more on which compiler is used than hardware.
The odd on so far seems to be VS. Could be interesting to see these binaries on other hardware.

Re: Pow(-1, Infinity()) - what are your results?

Posted: Mon Sep 10, 2012 6:30 am
by wilbert
OS X (Core 2 Duo), XCode 4.4.1

Code: Select all

1.000000
inf
1.000000
0.000000
inf
inf
0.000000
0.000000

Re: Pow(-1, Infinity()) - what are your results?

Posted: Mon Sep 10, 2012 6:38 am
by Demivec
Win XP Sp3 x86, AMD Athlon 64 Processor 3500+

Code: Select all

32Bit MinGW
1.000000
1.#INF00
1.000000
0.000000
1.#INF00
1.#INF00
0.000000
0.000000
---
32Bit VC2010
1.000000
1.#INF00
1.000000
0.000000
1.#INF00
1.#INF00
0.000000
0.000000
The first value of each test is different than what I get with PureBasic (posted elsewhere) even though they should be using the same functions.

Re: Pow(-1, Infinity()) - what are your results?

Posted: Mon Sep 10, 2012 6:26 pm
by DarkDragon
Thanks for all your answers, but I must say I've expected some more NaNs since this :lol: . Let's go on for a while.

Re: Pow(-1, Infinity()) - what are your results?

Posted: Mon Sep 10, 2012 6:51 pm
by c4s
Win XP SP3 x86, AMD Sepron Mobile Processor 3000+
32Bit MinGW
1.000000
1.#INF00
1.000000
0.000000
1.#INF00
1.#INF00
0.000000
0.000000
---
32Bit VC2010
1.000000
1.#INF00
1.000000
0.000000
1.#INF00
1.#INF00
0.000000
0.000000

Re: Pow(-1, Infinity()) - what are your results?

Posted: Mon Sep 10, 2012 7:07 pm
by moogle
Windows 7 x64 Intel i7-2700K
32Bit MinGW
1.000000
1.#INF00
1.000000
0.000000
1.#INF00
1.#INF00
0.000000
0.000000
---
64Bit MinGW
1.000000
1.#INF00
1.000000
0.000000
1.#INF00
1.#INF00
0.000000
0.000000
---
32Bit VC2010
1.000000
1.#INF00
1.000000
0.000000
1.#INF00
1.#INF00
0.000000
0.000000
---
64Bit VC2010
1.000000
1.#INF00
1.000000
0.000000
1.#INF00
1.#INF00
0.000000
0.000000
Press any key to continue . . .