[erlang-questions] erlang float comparison

Richard O'Keefe <>
Tue May 15 04:45:29 CEST 2012


The original message said something about comparing dihedral angles in
molecules.  I find myself wondering what the actual problem is that
the OP is trying to solve, and how much difference between two angles
is *physically* reasonable.

In one document I just found on the web, the H-O-H bond angle is
given as 107.5 degrees in one place and 104.5 degrees in another.
Another document calls it 105 degrees.

My 1st-year chemistry days are long past, but web pages I've checked
today seem not to quote any bond angles to better than 1 part in 1000
precision.  And since angles are constrained to [0,one circle), it
looks to me very much as if we have a case for representing bond angles
and dihedral angles as *fixed point* numbers, or at any rate for
rounding them to multiples of say (one circle)/65536 and comparing
the angles as integers.





More information about the erlang-questions mailing list