I would assue it's related to the precision intermediary results are stored in the registers in the CPU.
If this isn't sorted by the end of the week I'll whip up a java, but until then i'm a bit busy.
(see strictfp)
Community Assistance Required - Please Help :)
Last edited by madpeople on Mon Dec 15, 2008 6:51 pm, edited 1 time in total.
I'm suspecting something of this nature. I was going to further inquire as to machine config for anyone posting values which were significantly off the mark.madpeople wrote:QUOTE (madpeople @ Dec 15 2008, 06:47 PM) I would assue it's related to the precision intermediary results are stored in the registers in the CPU.
If this isn't sorted by the end of the week I'll whip up a java, but until then i'm a bit busy.
B

Granary Sergeant Baker - Special Bread Service (Wurf - 13th Oct 2011)
Well, since you haven't told us what methods you are using to calculate these numbers, and what results you're getting with them, I can only spectulate ...
Since all the numbers involved are roughly the same magnitude, I don't think you're running into the non-commutative nature of machine floating-point math (e.g., the fact that if you add lots of little numbers up first and then add it to a big number, you get a different result than if you took the big number first and added all the little numbers up after it. The reason being is rounding errors causing loss of precision).
Instead what I suspect is that in computing environment A, you're using 32-bit floats (~7 digits of precision) and in environment B you're using 64-bit doubles (~15 digits of precision).
Since all the numbers involved are roughly the same magnitude, I don't think you're running into the non-commutative nature of machine floating-point math (e.g., the fact that if you add lots of little numbers up first and then add it to a big number, you get a different result than if you took the big number first and added all the little numbers up after it. The reason being is rounding errors causing loss of precision).
Instead what I suspect is that in computing environment A, you're using 32-bit floats (~7 digits of precision) and in environment B you're using 64-bit doubles (~15 digits of precision).
Globemaster_III wrote:QUOTE (Globemaster_III @ Jan 11 2018, 11:27 PM) as you know i think very little of cashto, cashto alway a flying low pilot, he alway flying a trainer airplane and he rented
ASGS result: 277.90524170467012cashto wrote:QUOTE (cashto @ Dec 15 2008, 07:08 PM) Well, since you haven't told us what methods you are using to calculate these numbers, and what results you're getting with them, I can only spectulate ...
Since all the numbers involved are roughly the same magnitude, I don't think you're running into the non-commutative nature of machine floating-point math (e.g., the fact that if you add lots of little numbers up first and then add it to a big number, you get a different result than if you took the big number first and added all the little numbers up after it. The reason being is rounding errors causing loss of precision).
Instead what I suspect is that in computing environment A, you're using 32-bit floats (~7 digits of precision) and in environment B you're using 64-bit doubles (~15 digits of precision).
Everyone else: 277.90524170467029
The ASGS SQL Server definitely uses 64-bits for its FLOAT datatype. The error is minimal when performing the simple calculation listed above, but we have a load of much more hardcore maths running in AllegSkill, and one of the vital numbers is off by a whole 50% when compared to its correct value. I'm running and exact mirror of the ASGS AllegSkill code which renders correct results. As far as I can tell the problem *only* manifests on the ASGS box.
B
Edit: And the method was SELECT SUM(Mu * FractionPlayed)
Edit2: Although the ASGS value is precise to 15 digits
Last edited by sgt_baker on Mon Dec 15, 2008 7:55 pm, edited 1 time in total.

Granary Sergeant Baker - Special Bread Service (Wurf - 13th Oct 2011)
-
CronoDroid
- Posts: 4606
- Joined: Sun Nov 06, 2005 8:00 am
- Contact:
According to this IEEE calculator:sgt_baker wrote:QUOTE (sgt_baker @ Dec 15 2008, 11:46 AM) ASGS result: 277.90524170467012
Everyone else: 277.90524170467029
The ASGS SQL Server definitely uses 64-bits for its FLOAT datatype. The error is minimal when performing the simple calculation listed above, but we have a load of much more hardcore maths running in AllegSkill, and one of the vital numbers is off by a whole 50% when compared to its correct value. I'm running and exact mirror of the ASGS AllegSkill code which renders correct results. As far as I can tell the problem *only* manifests on the ASGS box.
B
Edit: And the method was SELECT SUM(Mu * FractionPlayed)
Edit2: Although the ASGS value is precise to 15 digits
277.90524170467012 = 4071 5E7B DEB9 C889
277.90524170467029 = 4071 5E7B DEB9 C88C
So the error you are seeing is 3 ulps. That could easily be accounted for due to the non-associative property of machine floating-point.
In English, everyone's elses compiler is doing the math exactly as you asked for it -- left to right. But since you're using SQL, under the hood the database might be fetching and/or computing the numbers in some random order.
My suggestion is that if an error as small as 3 ulps in an intermediate calculation results in a 50% change in the final result, then whatever algorithm you are using is highly succeptible to rounding error; you need to do some numerical analysis (for example, using interval arithmetic) to determine where you are losing precision.
Edit: I meant non-associative, not non-commutative.
Last edited by cashto on Mon Dec 15, 2008 8:44 pm, edited 1 time in total.
Globemaster_III wrote:QUOTE (Globemaster_III @ Jan 11 2018, 11:27 PM) as you know i think very little of cashto, cashto alway a flying low pilot, he alway flying a trainer airplane and he rented










