Re: [racket] Fun with denormalized floating point numbers

2012-08-01 Thread Neil Toronto
On 08/01/2012 11:40 AM, Michael Wilber wrote: ... Fascinating. I wonder if your machine has better floating point hardware So maybe this is just something to watch out for on older chips. 9000ms vs 350ms is a surprising difference! That's got to be software floating-point. I know my floatin

Re: [racket] Fun with denormalized floating point numbers

2012-08-01 Thread Asumu Takikawa
On 2012-08-01 12:40:04 -0600, Michael Wilber wrote: > Fascinating. I wonder if your machine has better floating point hardware > So maybe this is just something to watch out for on older chips. FWIW, on an AMD Phenom II X2 555: subnormal addition: cpu time: 1668 real time: 1680 gc time: 0 cp

Re: [racket] Fun with denormalized floating point numbers

2012-08-01 Thread Michael Wilber
(oops, forgot to cc: the list) Oh wow, that's interesting. Your code on my computer: subnormal addition: cpu time: 8156 real time: 8171 gc time: 0 cpu time: 9009 real time: 9035 gc time: 0 cpu time: 7740 real time: 7765 gc time: 0 cpu time: 7276 real time: 7288 gc time: 0 cpu time: 10643 real tim

Re: [racket] Fun with denormalized floating point numbers

2012-08-01 Thread Michael Wilber
Oh whoops, you're right. (expt 2 -1050) is an exact number so I'm taking a big performance hit from using exact numbers. But (expt 2.0 -1000) is inexact. To keep it from quitting instantaneously, I added a few 0s to the definition: (define (test value) (let loop ([count 1000] [x value])

Re: [racket] Fun with denormalized floating point numbers

2012-08-01 Thread Neil Toronto
I wonder how out-of-date the advice is to avoid subnormal numbers. I don't see any slowdown in my tests. I've written what I think is a good test program, and I have some experience with squeezing floating-point performance out of Racket. Can we get others on the mailing list to run it and repo

Re: [racket] Fun with denormalized floating point numbers

2012-08-01 Thread Tobias Hammer
But why ... (time-it (exact->inexact (expt 2 -1050)) test) 0 - 1 (time-it (exact->inexact (expt 2 -1000)) test) 0 - 0 ... and ... (time-it (expt 2 -1050) test_2) 26 - 28 (time-it (expt 2 -1000) test_2) 3 - 4 (time-it (expt 2 -1050) test) 26 - 28 (time-it (expt 2 -1000) test) 3 - 4

[racket] Fun with denormalized floating point numbers

2012-08-01 Thread Michael Wilber
So here's something fun to look out for in your own programs. On my slower 32-bit machine, very small numbers are much slower than slightly less small numbers. > (time-it (expt 2 -1000)) 126 - 235 > (time-it (expt 2 -1050)) 1187 - 2071 On my faster 64-bit machine, the performance difference is a