Is floating point division sufficient to determine bin number accurately? -
I'm trying to correctly account for the exact meridien crossing and I'm about IEEE floating point arithmetic Ran into the following question (Round for closest):
Let n be an integer, and d is a small positive number.
y = n * 360 - d & lt; n * 360
The guarantee is that floor ( y / 360) & lt; n All functions (* - & lt; / floor) should be treated as floating operations (for example, using double precision IEEE).
What will happen if some other positive floating point number in 360 of this question (The same question arises when a floating point quantity is being specified in the same distance box.)
N * 360 - D & lt; N * 360
-> 0 - d & lt; 0
-> D & gt; 0
is correct because " D (is) a shortened positive number".
n is irrelevant till now.
y = n * 360 - d
-> y / 360 = n - d / 360
- -> 0.0 & lt; = Q & lt; 1.0
,
floor (y / 360) + q = n - d / 360
-> floor (y / 360) - n = -q - d / 360 For all values of
, q
and d
, -q - d / 360 & lt; 0
->
Paving (y / 360) - n & lt; 0
-> Paving (y / 360) & lt; N
.
If the 360 has been changed from x
to any integer larger than 0, then the answer is still the same. I looks is also true if x
is replaced by any number> = 1.0. To think about 0 & lt; X & lt; 1
.
The smallest > of d
is still irrelevant - it's just a positive number ( d> 0
) .
Comments
Post a Comment