lua-users home
lua-l archive

RE: Associativity

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> I don't like the idea of optimizing by hand. For instance, what
> about "x = a..b..c..d" and "x = a..(b..(c..d))" ? Or to translate a
> formula "2x+1" as "x*2 + 1" (instead of a more natural "2*x + 1")?
>
> I think that someone that puts a non-associative tag method into '+' is
> asking for hard-to-find bugs ;-)
>
> -- Roberto
How about floating-point addition? It's not associative:
 eps = .5^53
 1.0 + (eps + eps) == 1.0000000000000002
 (1.0 + eps) + eps == 1.0
--Jeff

AltStyle によって変換されたページ (->オリジナル) /