[eeps] Multi-Parameter Typechecking BIFs
Bjorn Gustavsson
bgustavsson@REDACTED
Wed Mar 11 08:35:15 CET 2009
On Wed, Mar 11, 2009 at 1:10 AM, Richard O'Keefe <ok@REDACTED> wrote:
> (1) This test always costs time. But how much space
> does it actually save? I know it saves a boxed double
> when the test succeeds, but what proportion of the time
> does that actually happen?
>
> Avoiding allocation saves allocation and garbage collection
> time. But this avoidance here costs time, so what's the
> reason to believe that it saves more than it costs?
I have not measured so I am not sure that it actually saves anything.
But I try to share floating point values as much as possible bcause of
the way undos are implemented in Wings. Undo is very simply implemented
in Wings. It is just a queue where each element in the queue is the
entire state (all 3D objects in the scene). This works because unchanged
parts of the scene are shared.
>
> (2) Look at the code again:
>
> V0 = if V10 =:= V20 -> V10
> ; is_float(V10) -> 0.5*(V10+V20)
> end
>
> IEEE 754 arithmetic has been around for a *long* time
> now. So does it really fall to me to point out that
> the expressions V10 and 0.5*(V10+V20) are *not*
> always equivalent when V10 =:= V20 (in IEEE arithmetic).
While a compiler would not want to replace one expression
with the other, it is not a problem in Wings if the expressions
do not give exactly the same result.
/Bjorn
--
Björn Gustavsson, Erlang/OTP, Ericsson AB
More information about the eeps
mailing list