WLTools / LanguageSpec

A description of the language syntax and associated data, examples, and nonexamples.
MIT License
16 stars 1 forks source link

FE vs. CL: Incorrect flattening of `Times` *is* sometimes meaningful. #1

Open rljacobson opened 4 years ago

rljacobson commented 4 years ago

Issue is in Resources/KernelVsFE.md. From https://mathematica.stackexchange.com/a/216984/27662:

For example the Times issue you point out is not, in fact, always, semantically insignificant (for finite precision arithmetic). We actually have a fix for that in our internal prototype build and I'm optimistic it will make into our next major release. – Itai Seggev

IEEE floating point arithmetic is not associative. Here is a case where this behavior regroups parentheses:

(Notebook) In[1]:= FullForm[Hold[2*-+3]]
(Notebook) Out[1]//FullForm= Hold[Times[2,Times[-1,Plus[3]]]]

(Terminal) In[1]:= FullForm[Hold[2*-+3]]
(Terminal) Out[1]//FullForm= Hold[Times[2,-1,Plus[3]]]

But it's not clear to me how these could ever be different even if finite precision is used. Maybe there is a variation on this bug?