Hi, >> Is it just late on a Friday? Am I crazy? > > Floating point numbers are weird enough to drive anyone bat shit: > > #;1> (use numbers) > #;2> (define (log2 n) (/ (log n) (log 2))) > #;3> (log2 (expt 2 251)) > 251.0 > #;4> (flonum-print-precision 100) > 15 > #;5> (log2 (expt 2 251)) > 251.000000000000028421709430404007434844970703125
Thanks Peter! I'm mostly using log2 to work out if numbers are a power of two and find the highest bit that they have set. Is there a more robust way to do that in CHICKEN when using the numbers egg and bignums? Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0290 DA75 E982 7D99 A51F E46A 387A 7695 7EBA 75FF
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users