Timeline for How do you convert a vector of float numbers to bytes?
Current License: CC BY-SA 4.0
10 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jan 1 at 23:35 | comment | added | dalanicolai | Ah okay, I see. I will have to read up on number/byte representations:) | |
Jan 1 at 23:09 | history | edited | Drew | CC BY-SA 4.0 |
added 26 characters in body
|
Jan 1 at 22:18 | comment | added | John Kitchin |
I see. If I run M-x calc, then M-x calc-binary-radix I get your result. It still doesn't seem like the raw bytes I am looking for. I want something that is basically equivalent to the output of this in Python from struct import pack; pack('f', 3.14) which looks like b'\xc3\xf5H@' .
|
|
Jan 1 at 22:05 | comment | added | dalanicolai |
Ah, I did not realize that I had to configure the radix first using M-x calc-binary-radix (or M-x calc-hex-radix if you prefer). Calc and its documentation is somewhat of a black box to me.
|
|
Jan 1 at 21:51 | comment | added | John Kitchin | hm. that just outputs ("3.14") for me. That doesn't seem like the answer. I am expecting something that looks more like "\x1f\x85\xebQ\xb8\x1e\t@" | |
Jan 1 at 21:45 | history | edited | dalanicolai | CC BY-SA 4.0 |
added 755 characters in body
|
Jan 1 at 21:41 | comment | added | dalanicolai |
I forgot to mention that the function is found in the calc-bin 'library' (on Emacs 29) :)
|
|
Jan 1 at 21:30 | comment | added | John Kitchin | this code does not work for me. I get "Symbol’s function definition is void: math-format-radix-float". That function does not seem to exist in Emacs (ver 30 for me). | |
Jan 1 at 20:40 | history | edited | dalanicolai | CC BY-SA 4.0 |
added 4 characters in body
|
Jan 1 at 20:34 | history | answered | dalanicolai | CC BY-SA 4.0 |