[erlang-questions] Article on Erlang in ACM Queue

Alceste Scalas alceste@REDACTED
Tue Oct 14 14:15:38 CEST 2008


Il giorno mar, 14/10/2008 alle 07.28 -0400, Whit Armstrong ha scritto:
> does Erlang make guarantees about storing data in contiguous memory?
> My guess is that the binary data type was designed with that in mind.

Yes, binary data is guaranteed to be stored in contiguous memory.  See:

        http://erlang.org/doc/reference_manual/data_types.html#2.4


> However, do I understand correctly that floats cannot be stored in a
> binary data type?

Sure they can, just try with:

    %% Single precision
        Y1 = <<1.0:32/native-float,
               2.0:32/native-float,
               3.0:32/native-float>>.
        
    %% Double precision
        Y2 = <<1.0:64/native-float,
               2.0:64/native-float,
               3.0:64/native-float>>.

More details on:

        http://erlang.org/doc/reference_manual/expressions.html#bit_syntax

Regards,
-- 
Alceste Scalas <alceste@REDACTED>
CRS4 - http://www.crs4.it/




More information about the erlang-questions mailing list