emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: osc-insert-float32


From: Mario Lang
Subject: Re: osc-insert-float32
Date: Tue, 17 Dec 2019 22:10:56 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)

Stefan Monnier <address@hidden> writes:

> Mario Lang [2019-12-17 19:04:11] wrote:
>
>> 14 years ago, I wrote this beast to be able to send IEEE floating point
>> values over the network (Open Sound Control).  Reading it today, I am
>> actually surprised I was driven enough to get this working.  I am
>> wondering, is there a better way to achieve this today?
>
> There's `frexp` to extract the exponent and the mantissa.

Oh, I didn't know that either.  However, it looks like `frexp' isn't very
useful when it comes to encoding to binary.  It is a bit too long ago
that I researched the binary32 encoding and wrote the code in question,
but from diving back into the matter, it looks like the mantissa
in binary format is in the 1.0..2.0 range.  frexp gives 0.5..1.0, so the
exponent is also off for what binary needs.  I guess I could just adjust
those values, but I dont really know what I am doing here, so I'll leave
it as it is for now.  Thanks for the food for thought though.

-- 
CYa,
  ⡍⠁⠗⠊⠕



reply via email to

[Prev in Thread] Current Thread [Next in Thread]