Hi everybody, > On 1. Dec 2021, at 23:21, Linus Torvalds <torva...@linux-foundation.org> > wrote: > > It's certainly not a known issue, the FP precision thing was just a guess. > > And honestly, the differences seem to be too big to be FP precision > issues, particularly the i386 kind where the most common issue is that > the calculations are done with a 64-bit mantissa rather than a 53 (or > 24, for 'float') bit mantissa. > > If I'm seeing things right (not a huge fan of CSV files with lots of > columns), the EAD difference are things like 6407.426376 -> > 6386.683739. Not exactly least-significant-digit kind of thing. > > I'm not seeing what's going on, but it smells like some instability in > the calculations rather than some extra non-ieee precision of the > i387. > > But it's also not any kind of *cumulative* error - looking at that > diff, the very next line both files have an ead column with the same > value (6508.706786). > > Very strange. Why would that odd difference only show up on 32-bit i386? > > Adding Robert to the cc, in case he sees what is up. I thionk all the > EAD calculations are his code. Robert?
I have no idea where this could come from. the EAD is calculated in profile.c straight forwardly as entry->ead = (entry->depth + 10000) * fn2 / (double)N2_IN_AIR - 10000; and fn2 a few lines above as fn2 = (int)(1000.0 * entry->pressures.n2 / amb_pressure); In the diff, both versions agree that entry->depth is (I am looking at line 7 of the CSV) 1830, entry->pressures.n2 is 0.947618, amp_pressure is 1.198000 and the macro N2_IN_AIR expands to 781. Plugging all this into my HP 45 SD, I get 1981.472471 which is the value in the reference file. Before subtracting 10000, the difference between 1981.472471 and 1966.325224 amounts to about 1.5% which should be far too much for floating point rounding error in such a calculation. To investigate this further, I would place a breakpoint in line 1260 of profile.c and check how it arrives at the resulting value. Best Robert
signature.asc
Description: Message signed with OpenPGP
_______________________________________________ subsurface mailing list subsurface@subsurface-divelog.org http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface