-
Notifications
You must be signed in to change notification settings - Fork 112
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
Add cpp_double_fp and exercise arithmetic_tests #515
base: develop
Are you sure you want to change the base?
Conversation
The first CI run (even with only the tiny step of arithmetic tests and modified but not running function tests) has failed due to a rookie typo involving a missing semicolon. Running again now... |
OK the last CI run passed on GHA but failed a silly typo on performance_test on Circle CI. The latest push goes a lot farther with an attempt for:
|
OK.
I will press on trying to correct the Jamfile for the drone runs. After the next cycle, I can collect the know weaknesses - and there are a few, especially with 10-byte And although this is going well, I'd like to resolve any known mysteries (maybe review needed) before pressing on to specfun and maybe more deep conversoin tests. |
OK. I'll jump the CI a bit and think this latest commit might bring this work to a small juncture. At this juncture, coull you John (@jzmaddock) and Matt (@mborland) please take a cursory glance at the header/tests and give me a sanity check? If you see something waaayyy wrong or out of line, please give me a heads up? Most of the tests and things are handled by Known problems include:
In light of this, I'll retreat to the fork a bit and try to look into at least the 10-byte After solving the mysteries, going for spec_fun and setting up some rudimentary docs, this thing will actually be close to ready. Cc: @sinandredemption and @cosurgi |
@ckormanyos my apologies for not being able to help out much right now: but a quick scan over the sources shows nothing obviously wrong. |
Thanks John (@jzmaddock) I'm actually doing alright. I am always amazed how powerful and deep the Multiprecision test suite(s) are. These are wonderful tests. I've found a few dependencies on |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By and large this looks good. I added some minor comments that are applicable in a number of places.
OK. This seems like it's about to go green, which means that the formal correctness of There are, nonetheless, a whole bunch of steps to do.
These include:
The only known problem is with banker's rounding. Otherwise, it's just optimize, tests and docs. The The next step for Boost testing will be to run the So I'll ask John (@jzmaddock), very briefly in a few keywords, how do I hook up a new backend to specfun testing in CI? briefly. |
Hi @jzmaddock I think I'm seeing the pattern. I need to:
I'll try in my fork first. |
Yup, duplicate this rule: multiprecision/test/Jamfile.v2 Line 1472 in 8de4503
multiprecision/test/Jamfile.v2 Line 1521 in 8de4503
Then modify https://github.com/boostorg/multiprecision/blob/develop/test/math/setup.hpp to set up testing of the new type, again copy the float128 case is the easiest way for what you have. Finally, duplicate and modify this line:
And I think/hope that's the lot. |
Copy that John (@jzmaddock). It looks like the struggle with VC 14.0 continues a tiny bit. And maybe some other lint. But I'm ready to give specfun for I keep looking ahead to the future, but after all that (and I do expect success), then the adaption of quad-float (from the original feature-request) should get a lot easier... |
And what does all this mean in the practical sense. I actually think we have a fair shake (and i'd like to give it a fair try) to get Then I think later in the year we can take a more coherent run at quad-float, maybe even after getting some of the field experience with double-float. Cc: @jzmaddock and @sinandredemption and @mborland |
Tolerances should be broadly in agreement with similar backends - so say cpp_bin_float_quad. The special fun tests are actually very good at really hammering basic arithmetic and have uncovered more than a few bugs in the past, so if you see anything wildly out, I would suspect a bug somewhere. |
Indeed that's for sure John (@jzmaddock). I'm psyched on finding out how it goes. I guess there are still a few remaining problems in CI so I'll work through these prior to going for specfun. This is the first time I've tried to add an entire backend on my own. It's challenging but a great learning experience. Also to be clear, I'm only (we're only) going for |
This first step took a while and has now gone green. We still need the following:
I am happy with this first preliminary green milestone and will now turn to points 1 and 2, beginning with specfun. At first I'll prepare this in our GSoC fork. Cc: @jzmaddock and @sinandredemption and @cosurgi and @mborland |
Hi John (@jzmaddock), I wonder if you could help just a tiny bit with guidance? Much to my delight my local tests of I got Now I need to see the failures. From these failures on For ====== BEGIN OUTPUT ======
Running 1 test case...
Tests run with GNU C++ version 9.3.0, GNU libstdc++ version 20200808, linux
Zeta: Random values greater than 1 with type cpp_double_double
zeta<cpp_double_double> Max = 0.1958 RMS Mean=0.0706
worst case at row: 12
{ 4.988127231597900390625, 1.037268683773212337925891820825986369163 }
Zeta: Random values less than 1 with type cpp_double_double
zeta<cpp_double_double> Max = 147.7 RMS Mean=13.23
worst case at row: 69
{ -17.99382781982421875, -0.08425805633923885570999830270532256204479 }
Zeta: Values close to and greater than 1 with type cpp_double_double
zeta<cpp_double_double> Max = 0.19 RMS Mean=0.08633
worst case at row: 22
{ 1.49527740478515625, 2.631125733364186076058384433696635480314 }
Zeta: Values close to and less than 1 with type cpp_double_double
zeta<cpp_double_double> Max = 1.003e+04 RMS Mean=2735
worst case at row: 16
{ 0.999987542629241943359375, -80273.18355079243243774478653269383556504 }
Peak error greater than expected value of 1000
../../../libs/math/test/handle_test_result.hpp(165): �[1;31;49merror: in "test_main": check bounds.first >= max_error_found has failed�[0;39;49m
Mean error greater than expected value of 200
../../../libs/math/test/handle_test_result.hpp(170): �[1;31;49merror: in "test_main": check bounds.second >= mean_error_found has failed�[0;39;49m
Zeta: Integer arguments with type cpp_double_double
zeta<cpp_double_double> Max = 8.453 RMS Mean=2.34
worst case at row: 54
{ 56.0, 1.0000000000000000138777878097252328 }
�[1;31;49m*** 2 failures are detected in the test module "Master Test Suite"
�[0;39;49m
EXIT STATUS: 201
====== END OUTPUT ====== Build result: ...failed updating 12 targets...
...skipped 12 targets...
...updated 337 targets... Now I'm having difficulty identifying exactly which lines/cases/tests are needing special attention. |
So if we look at:
The case causing the failure is That case should go through:
which is a rational approximation and should be super accurate - maybe check that the constant coefficients are being initialized correctly? For comparison, maybe check the error rate for cpp_bin_float_quad. BTW I've been meaning to create a "dual precision" backend for multiprecision that would let you run the same calculation on two backends simultaneously and see where they they start to differ. |
Just tried:
I get an error of 0, which looks good to me, so the difference with the double double looks like it might be real? |
Indeed. I stepped through the impl. Your exact result makes sense to me. It especially makes sense, now that I study the implementation of I fear this might take us all the way back to some fundamental bit-losses in the basic operations add/sub/mul/div in the low-level implementation of We have an open issue (one of the first issues from July 2021) in the GSoC about this. I fear that this type (its low-level eval_ops might not be fully cooked yet. Cc: @sinandredemption This is something we still need to fully understand. |
Ahhh. OK, John (@jzmaddock), well, I figured out at least partly what's going on, but I don't know the best way to fix it entirely in the backend/test/etc. world.
If I simply use the I'll need to see if the backend (on its own) can handle the case decision to initialize with the native floating-point type OR string. I think I might need more constructors. Or if the backend can't handle this alone, then we need to think harder. |
Is that not an error in string conversion then: I would assume it should convert to an exact binary value? |
I suppose maybe. That's what I was thinking and I do hope to find a solution there. I went (lazily) directly to |
Hi John (@jzmaddock) regarding string input for This will pull Along the lines of getting it working and then optimizing it, I find a usage of the I do not know if my ramblings make sense. But If so, I'd duplicate your code, test it, then with you together, find a way to make it publicly available for binary backends. Thoughts? Am I crazy? |
Probably crazy to want to take on that much coding, but yes, I fear that is the correct way to go. The hard part is probably packing the bits in the resultant integers into the float type. |
@ckormanyos Please do let me know in chats if you need an extra hand. I've been trying to start contributing again. |
It is great to see you going forward with this. Unfortunately I cannot join right now: too much work at the university at the moment :( But I will keep monitoring your changes, hoping to jump in when it becomes possible. |
Thanks for your input John. Yes. I will try - based on Your code that is already fully tested, well-established and cleanly available in This will have a bit of coding depth to it, so best to hammer this particular detail in our fork. |
Hi Fahad (@sinandredemption) we'll be moving back and forth to/from our GSoC fork for a couple of the more in-depth corrections. This PR has already shown that:
I am going to start the first ponit back in our fork. I'll be posting more details on the above-mentioned issues of the fork. We can work out the heavy details there, and we can keep this PR open as we progress. |
The purpose of this pull request is to add the
cpp_double_fp_backend<>
template class.In the initial commit, we:
TEST_CPP_DOUBLE_FLOAT
, but do not run them yet.arithmetic_tests.hpp
that improve the testing logic for mixed-int128/float128 interaction.If this runs through, I can add the function tests (stuff like
sin()
,exp()
, etc.) as a next step. These run well and properly in the GSoC fork, but are not yet exercised in this initial commit.