-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Find out which values fail between the ISO 2533 tables and the calculated values #19
Comments
Assuming #20 gets merged... Awfully many, actually? For whatever reason, the calculations seem to be failing for most of the tests, bar these we originally had... On a quest to find why :) |
Found an error that the upper layer was being selected in a place, rather than lower; besides that, only pointing a finger at it so far, but it seems that the data in |
E.g. calculations from the corrected layer version:
Data from rows-h, rows-H:
Another data point, calculations:
Data from rows-h, rows-H:
|
@ronaldtse Should we only use the rows-H data here, or any insights on what's going on? |
Thinking about it for a while more, I guess that rows-h would actually need to calculate based on the geometric altitude for us to get the correct results from it... |
With the latest version in #20, seems like the constant thing for many variables is actually the number of significant digits, not decimal places, gotta adjust accordingly... |
I can see there is now a pattern:
Among the failures:
|
Clearly, g, mu, h, H_p have to be correct for others derived values to be correct... So starting with the least failures working onto the rest. |
I just wonder if you might be authorized to give me (in a private channel, I suppose) the whole tables to look at? Forty minutes (and some slower, very precise calculators) in, if some of these are not OCR errors, I'm thinking that some imprecisions might actually have to be introduced this time to replicate some of these results? Now going to look at a Minsk-22 emulator, meanwhile :^) Edit: the emulator idea doesn't look all that promising after all... |
@newbthenewbd the full document(s) can be found at https://github.com/metanorma/iso-2533/ where you have access. The tables are already encoded in YAML as the files you originally processed. |
@newbthenewbd if we are seeing rounding / floating point issues we need to report them back to the committee that holds this document. For better accuracy, we might want to use the advanced number handling functionality in Ruby such as BigDecimal. |
Oo, thank you! But it seems that I don't actually have access to this repo... The YAML version has clearly been OCR-ed and contains at least some errors, e.g. from my --- a/spec/fixtures/iso-2533-1975-table5.yaml
+++ b/spec/fixtures/iso-2533-1975-table5.yaml
@@ -9823,7 +9823,7 @@ rows-H:
temperature-K: 277100
temperature-C: 3950
p-mbar: 8.25013e+2
- p-mmHg: 6.l8811e+2
+ p-mmHg: 6.18811e+2
density: 1.03720e+0
acceleration: 9.8014 Do you mean that these should be reported in a special way? I know about BigDecimal, the thing is, for example
|
I am basically not saying that the tables are per se incorrect (well, except for the YAML ones, that's on the OCR :^) ), rather, the exact process through which they were devised had been lost along with a 37-bit computer from the 70's, so once improving accuracy doesn't help... I really hope the OCR was just really bad, and would like to check :)) |
@newbthenewbd Let me fix the access permissions. We obviously want to fix the OCR errors. Before we report back to the committee we want to be sure that the values we report to be "not reproducible" are really non-reproducible even when we use a more "modern" accuracy. 😉 |
@newbthenewbd fixed! |
Hacked together a quick-and-terrible BigDecimal version, all the errors are still here... Feeling guilty working with little to show for it :( But if I didn't miss something to BigDecimal-ize, I still contend that too low accuracy is less likely to be our culprit than too high, as Ruby uses double precision IEEE 754 floating point numbers (11 bits of exponent, 53 bits of mantissa), and Minsk-22 has, according to the unofficial emulator's documentation:
So, just with regular Ruby floats (equivalent to C doubles), we should actually be more accurate! |
With single-precision floats and the operations reordered like this: float f = 6356766.0f;
f /= 6356766.0f - 30650.0f;
f *= 30650.0f;
printf("%f\n", f); We actually turn up the "wanted" result for this one:
But the problem is, Ruby doesn't have these! |
@newbthenewbd is it possible to use a "diff in least significant digit" difference indicating that the number we get is nearly identical to the original except for the least significant digit? ie. if a failure is a difference in the last significant digit, we consider that a float implementation difference, not a real error. |
That could work as a last resort; I also want to look a little bit closer at these variables with many more failures, could be something more easily correctable there, just haven't gotten to it yet :) |
@newbthenewbd once this is somewhat done (matching the numbers isn't the most important) we want to move onto the other tables. Thanks! |
As in, the extra formulas, or table generation? :) |
Both please 😊 |
Eventually of course, haha :) |
Ok, getting to it when I get home today, definitely waited long enough already... :) |
Found something interesting, apparently the original process did limit the pressure layers to six significant digits right in the calculations, that brings it down to 1847 errors... Taking a break again soon, but this time only for a couple hours 😄 |
Or not, because an experiment to try to get some of the calculations closer to their 32-bit float results at least (ugh, Ruby) makes for only 1816 errors... Honestly, I believe that it might take doing this in a more powerful language (with more powerful tools already existing), or inventing some very arcane Ruby ourselves, to match them all :( Going to push this unfinished experiment to a separate f32 branch, presuming that the version sans my attempts is actually closest to truth, and do as you say! |
@newbthenewbd in any case the point is not really to "match" the numbers, but to say that our numbers are "okay" with a defined rule, e.g. in a range of the |
@newbthenewbd so we currently have 401 values out of 20321 calculations that deviate in the last significant digit from the original tables due to floating point rounding: https://github.com/metanorma/atmospheric/actions/runs/8487801016/job/23256038850 According to the values, these differ in the last significant digit by 2. Can we have a "relaxed" mode that we relax the rules so that they pass? |
I've just tried to generate ISO 2533:1975 based on the outputs of this, and values jump around in order of magnitude abruptly every few rows. In the YAML generated: p-mmHg: 9.58450e2 This tells me that the +3, +5 etc order of magnitude signs in the original are not propagating to following rows in the same column, like they are supposed to; I presume the source is: p-mmHg: 9.58450 +2 And sure enough: That is a pretty foundational misunderstanding of the source, and it makes the outputs of this gem unusable. |
No description provided.
The text was updated successfully, but these errors were encountered: