Replies: 4 comments 1 reply
|
The C math library stuff just calls the FORTRAN library stuff. So it appears the usual libraries don't support negative exponents. Boo. Hiss. What platform gives you 16.5? |
|
You might try running this on the other Prime emulator to make sure it isn't an emulator problem. The emulator handles floating point by converting from Prime to IEEE, doing the operation, then converting from IEEE to Prime. Wouldn't surprise me if there is a bug somewhere that maybe the Prime hardware diagnostics didn't catch or that I overlooked. |
|
Hmm. From Jan's emulator: |
|
Yeah, as much scientific work was done on Primes, it would surprise me if their exp() library function was that broken. It's nice having another reference to test these things without having to fire up a real Prime. Thanks @janjaeger! |
Uh oh!
There was an error while loading. Please reload this page.
Hey all -
While running a benchmark on the p50 emulator running Primos v22 I came across an error I didn't expect to see. Maybe I'm doing something wrong, and am looking for guidance.
I won't bore you with the benchmark program, but what I found was the exp() function returns 0 for negative values. Here is example code and results:
/* t2.c - test exp() function
k theis 10 2021
compile w/ ci t2 -ansi
filmem
link w/ bind -li ccmain -lo t2 -li c_lib -li
*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
double val, res;
int main(int argc, char *argv[]) {
int n=0;
val = -2.0;
for (n=0; n<10;n++) {
res = exp(val);
printf("exp(%10.4f) = %10.4f\n",val,res);
val += 0.5;
}
}
When run on the emulator I get these results:
OK, r t2
exp( -2.0000) = 0.0000
exp( -1.5000) = 0.0000
exp( -1.0000) = 0.0000
exp( -0.5000) = 0.0000
exp( 0.0000) = 1.0000
exp( 0.5000) = 1.6487
exp( 1.0000) = 2.7183
exp( 1.5000) = 4.4817
exp( 2.0000) = 7.3891
exp( 2.5000) = 12.1825
OK,
When run on my linux box with glibc I get:
$ ./t2
exp( -2.0000) = 0.1353
exp( -1.5000) = 0.2231
exp( -1.0000) = 0.3679
exp( -0.5000) = 0.6065
exp( 0.0000) = 1.0000
exp( 0.5000) = 1.6487
exp( 1.0000) = 2.7183
exp( 1.5000) = 4.4817
exp( 2.0000) = 7.3891
exp( 2.5000) = 12.1825
My calculator and other devices give me the 2nd results as well.
Am I doing something wrong compiling or linking? Am I missing something?
BTW: the whetstone benchmark shows my emulation runs about 16.5 MIPS.
All reactions