Erlang workshop and user conference

Bjorn Gustavsson bjorn@REDACTED
Tue Oct 2 17:12:23 CEST 2001


James Hague <jamesh@REDACTED> writes:

> > You find the proceedings from the Erlang/OTP
> > user conference in
> > 
> > http://www.erlang.se/euc/01/
> 
> Wow, the Wings project is exciting!  That the graphics calls are implemented
> with message passing and even though floating point has never been Erlang's
> strong point makes it even more impressive.

By a curious coincidence, floating point operations happens to be
significantly faster in R8, provided that the compiler can figure
out the types.

To let the compiler know, simply use the guard test float/1,
for instance:

cross({V10,V11,V12}, {V20,V21,V22}) when float(V10), float(V11), float(V12),
					 float(V20), float(V21), float(V22) ->
    {V11*V22-V12*V21,V12*V20-V10*V22,V10*V21-V11*V20}.

> 
> On the subject of floating point, I was recently thinking "What if Erlang
> had a floating point vector type instead of individual floats?"  Right now,
> floats are indepdently heap allocated, so the tuple {1.0, 1.0, 1.0} exists
> as four separate data objects.  With a a floating point vector type there
> would be one data object.  This would open to door to writing APL-style
> vector operations, where 1.0 + |1.0,2.0,3.0| would result in |2.0,3.0,4.0|.
> The bare float 1.0 is shorthand for |1.0|.  This would allow really fast 3D
> math in Erlang.  (Just add built in operations for normalize, magnitude, dot
> and cross products, and this would be amazing.)

Interesting idea. It is too late to add it to R8, though... :-)

> 
> Musing, musing...
> 
> James
> 

/Bjorn
-- 
Björn Gustavsson            Ericsson Utvecklings AB
bjorn@REDACTED      ÄT2/UAB/F/P
			    BOX 1505
+46 8 727 56 87 	    125 25 Älvsjö



More information about the erlang-questions mailing list