[erlang-questions] Float to binary

Bob Cowdery <>
Mon Mar 21 23:27:09 CET 2011


Its part of a binary that gets sent to a device. Its not actually a
scaling factor its simply a conversion from MHZ to Hz. 1 MHz =
1000000Hz. The frequency internally is a float but needs to be a 32 bit
big-endian number in Hz to send to the device.

Bob

On 21/03/2011 21:24, Richard O'Keefe wrote:
> On 22/03/2011, at 3:09 AM, Bob Cowdery wrote:
>
>> If I have a float value. This happens to be a frequency in MHz which I
>> need to convert to a 32 bit integer big-endian format in Hz
> What do you actually mean?
> What is the range of values?
> What is their precision?
> Why won't a simple
>
> 	round(The_Frequency * Scaling_Factor)
>
> do the job?
>
>



More information about the erlang-questions mailing list