Andy Bennett scripsit: > #;5> (log2 (expt 2 251)) > 251.0 > #;6> (ceiling (log2 (expt 2 251))) > 252.0 > > Is it just late on a Friday? Am I crazy?
Trying (log2 (expt 2 251)) in Racket, which prints 64-bit floats accurately (unlike Chicken, which depends on C to do it) returns a value of 251.00000000000003. The ceiling of that is indeed 252.0. As Kernighan and Plauger said back in 1974: "Floating point numbers are like sandpiles: every time you move one, you lose a little sand and pick up a little dirt." It's still true. -- John Cowan http://www.ccil.org/~cowan co...@ccil.org Barry thirteen gules and argent on a canton azure fifty mullets of five points of the second, six, five, six, five, six, five, six, five, and six. --blazoning the U.S. flag _______________________________________________ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users