IRC channel logs

2022-08-28.log

back to list of logs

***Furor is now known as Colere
<Zelphir>I just learned about writing decimal numbers with #e prefix, if one wants exact numbers. So neat! I sometimes wrote a division to get rationals, like (/ 1 10) for example, but writing #e0.1 should be more readable.
<Zelphir>How would I get the bytes of a float number? I would like to write floats in binary to a file. I think I should use (put-bytevector ...) from https://www.gnu.org/software/guile/manual/html_node/Binary-I_002fO.html. Or is there another way?
<antipode>put-bytevector writes a bytevector to a port
<antipode>By itself, it doesn't write floating-point numbers.
<antipode>Try bytevector-ieee-double-set! + bytevector-ieee-double-ref
<antipode>The exact endianness doesn't matter, as long as you remain consistent.
***sneek_ is now known as sneek
<Zelphir>Ah, thanks! I think I misunderstood (bytevector-ieee-double-set ...) before.
***Noisytoot_ is now known as Noisytoot
***Noisytoot is now known as [
***[ is now known as Noisytoot
***examors_ is now known as examors
<davidl>ArneBab: thanks for the link. I ended up writing a recursive function with accumulation variable. Maybe not lispy-elegant, but it works. The reverse lines thing you used was useful.
<ArneBab>davidl: glad to help :-)