floating-point representation

david wallin david@REDACTED
Wed Jun 6 23:55:03 CEST 2001

Hi all,

I'm trying to create (32-bit) floats from binaries (using the bit syntax).

Empirical tests showed this to be a naive idea :

A = random:uniform(256),
B = random:uniform(256),
C = random:uniform(256),
D = random:uniform(256),

<<Float:32/signed-float>> = <<A, B, C, D>>.

(depending on the values of A,B,C,D ; this can result in a badmatch).

What kind of representation is used for floats (is this a local issue) ?

Also, is there any way to tell what precision that erlang uses ?


More information about the erlang-questions mailing list