Re: [q-lang-users] q 7.11 tests fail on Mac OS X
Brought to you by:
agraef
From: Ryan S. <rya...@us...> - 2008-06-11 10:58:33
|
On Jun 10, 2008, at 00:40, Albert Graef wrote: > Ryan Schmidt wrote: > >> I would love to know how the arithmetic test (or maybe q in general) >> does its math though. I can't get any other app to tell me that 2 * 2 >> == 4.4501477170164897e-308, and finding out how it's computing that >> might help me isolate what's wrong with my computer. > > You can find all the arithmetic routines in qmfuns.c, look for > qmadd et > al. Bigint arithmetic is done using the gmp routines, double > arithmetic > using the C floating point operators. Apart from that, it's just > boxing/unboxing, which are just accesses to a C struct, nothing > unusual > there. > > The bigint arithmetic seems to work, since the first two results > are ok. > It's the mixed double/bigint arithmetic that fails there. The > bigint -> > double promotion is done using another GMP routine, mpz_get_d, I don't > see how that could go wrong unless GMP is broken on that machine. > > You could try whether just plain double arithmetic works. If you > can run > the interpreter from the command line, try something like '2.0*2.0' > instead of '2*2.0', or edit test.q accordingly and run 'make test'. Thanks. Turns out my gmp is broken, and I know why [1] and I'm working to fix it. The fun output from q: ==> 1*1 1 ==> 1.0*1.0 1.0 ==> 1*1.0 2.22507385850824e-308 ==> 1.0*1 2.22507385850824e-308 [1] http://gmplib.org/list-archives/gmp-bugs/2008-June/001031.html |