How many floating-point numbers are in the interval [0,1]?http://lemire.me/blog/2017/02/28/how-many-floating-point-numbers-are-in-the-interval-01/ …
-
-
Replying to @lemire
Related -- Taylor Campbell's nice writeup: http://mumble.net/~campbell/2014/04/28/uniform-random-float …
2 replies 2 retweets 7 likes -
Replying to @stephentyrone @lemire
I wrote this just the other day (image since gist is down with everything else)pic.twitter.com/V55t0sVPB0
2 replies 0 retweets 6 likes -
off by one: this counts -0.0 in the range!
1 reply 0 retweets 2 likes -
OTOH it doesn't count +0.0, so ... /shrug/
1 reply 0 retweets 1 like -
f >= 0 should?
1 reply 0 retweets 0 likes -
But the loop will never execute on the all-zeros bit-pattern. =)
1 reply 0 retweets 1 like -
derp you're right! I hadn't noticed that. I'm off by one in my off by one. Carry on!
1 reply 0 retweets 6 likes -
Walking through all values of an integer type is the secret third hard problem in CS.
2 replies 4 retweets 8 likes
The do statement is your friend.
-
-
Replying to @RichFelker @jfbastien and
Don't tell the "for is the only loop structure you need" crowd.
0 replies 0 retweets 4 likesThanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.