sprintf("%e",exp(511));
(2) Result: "8.404e+221"
sprintf("%f",exp(511));
zsh: segmentation fault pike
I'll add it to the testsuite if noone protests.
What kind of test did you have in mind? The correct result varies with what kind of floats you are using, and the printf function in the libc. I get
sprintf("%f", exp(511));
(1) Result: "Inf"
/ Marcus Comstedt (ACROSS) (Hail Ilpalazzo!)
Previous text:
2003-01-05 11:05: Subject: exp(511)
sprintf("%e",exp(511));
(2) Result: "8.404e+221"
sprintf("%f",exp(511));
zsh: segmentation fault pike
I'll add it to the testsuite if noone protests.
/ Mirar
The test_true(stringp(sprintf("%f",exp(200)))) kind, obviously.
/ Martin Nilsson (bygger parser
Previous text:
2003-01-05 13:57: Subject: exp(511)
What kind of test did you have in mind? The correct result varies with what kind of floats you are using, and the printf function in the libc. I get
sprintf("%f", exp(511));
(1) Result: "Inf"
/ Marcus Comstedt (ACROSS) (Hail Ilpalazzo!)
No, it was not obvious from Mirars text that this was the kind he had in mind. Only that it would involve `sprintf("%f",exp(511))' (and possibly `sprintf("%e",exp(511))' and/or `"8.404e+221"') somewhere.
/ Marcus Comstedt (ACROSS) (Hail Ilpalazzo!)
Previous text:
2003-01-05 13:59: Subject: exp(511)
The test_true(stringp(sprintf("%f",exp(200)))) kind, obviously.
/ Martin Nilsson (bygger parser
I'm happy as long as it doesn't segfault. It probably has a problem because I'm using double precision (up to around e^180 is ok).
I added tests to check that it returns strings for medium (e^200) and large (e^65536) for all five float formats.
/ Mirar
Previous text:
2003-01-05 13:57: Subject: exp(511)
What kind of test did you have in mind? The correct result varies with what kind of floats you are using, and the printf function in the libc. I get
sprintf("%f", exp(511));
(1) Result: "Inf"
/ Marcus Comstedt (ACROSS) (Hail Ilpalazzo!)
Hmm. My data point:
exp(101);
(1) Result: 73070599793680668906492145854235224565612544.000000
exp(102);
Segmentation fault
Pike 7.4.13 on Linux 2.4.17 i686, glibc-2.3.1
The segfault is due to sprintf("%O",...); write("%e", exp(x)) is OK up to x=710 (at which point it turns "inf" of course).
Aah, nearly forgot: --with-long-double-precision.
/ rjb
Previous text:
2003-01-05 21:37: Subject: exp(511)
I'm happy as long as it doesn't segfault. It probably has a problem because I'm using double precision (up to around e^180 is ok).
I added tests to check that it returns strings for medium (e^200) and large (e^65536) for all five float formats.
/ Mirar
pike-devel@lists.lysator.liu.se