[erlang-questions] Article on Erlang in ACM Queue

Anders Nygren anders.nygren@REDACTED
Tue Oct 14 15:14:08 CEST 2008


On Tue, Oct 14, 2008 at 6:28 AM, Whit Armstrong
<armstrong.whit@REDACTED> wrote:
> Thanks for the feedback everyone. FFI looks very interesting.
>
> does Erlang make guarantees about storing data in contiguous memory?
> My guess is that the binary data type was designed with that in mind.
> However, do I understand correctly that floats cannot be stored in a
> binary data type?
>
> for instance:
>
> Eshell V5.6.3  (abort with ^G)
> 1> X = <<1,3,9>>.
> <<1,3,9>>
> 2> Y = <<1.0,3.0,9.0>>.
> ** exception error: bad argument
> 3>
>
> or am I missing something obvious?
>

You need to tell the compiler that it is supposed to be floats.
Like
Y = <<1.0/float,3.0/float,9.0/float>>.
<<63,240,0,0,0,0,0,0,64,8,0,0,0,0,0,0,64,34,0,0,0,0,0,0>>

see the documentation, especially
http://erlang.org/doc/programming_examples/bit_syntax.html#4
for more details

/Anders

> Can anyone refer me to the source file that defines binary data types?
>
> Thanks,
> Whit
>
>
>
>
> On Fri, Oct 10, 2008 at 10:03 AM, Ulf Wiger (TN/EAB)
> <ulf.wiger@REDACTED> wrote:
>> Whit Armstrong skrev:
>>>
>>> I'm new to Erlang. I've been considering it for a few simulation
>>> projects in finance.  However, I was discouraged because the ACM
>>> article suggests that Erlang has poor floating point performance.
>>>
>>> Are any list members using Erlang for numerical simulations?  If so,
>>> do you have any advice on how to how to improve efficiency?  What
>>> about using binaries to store vectors of doubles?  Are there any
>>> extensions of Erlang that allow one to do that?
>>
>> Perhaps this might at least give you some initial intuition:
>>
>> High-performance Technical Computing with Erlang
>> Alceste Scalas Giovanni Casu Piero Pili
>> Center for Advanced Studies, Research and Development in Sardinia
>> ACM ICFP 2008 / Erlang Workshop
>> September 27th, 2008
>> Victoria, BC, Canada
>>
>> http://www.erlang.org/workshop/2008/Sess23.pdf
>>
>> BR,
>> Ulf W
>>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions
>



More information about the erlang-questions mailing list