BoostGSoC21 / multiprecision

Boost.Multiprecision
Boost Software License 1.0
2 stars 0 forks source link

Avoid negation zero and go to Briggs algos #147

Closed ckormanyos closed 1 year ago

ckormanyos commented 1 year ago

The purpose of this pull request is to (hopefully) clean up and clear up the remaining failing edge-cases in the ´cpp_double_fp<>` backend.

In the initial commit, we correct an important negation of zero (in the negate() function) that had been causing a bunch of stuff to go haywire.

We also revert to Briggs-style algorithms and note that there is a separate compiler switch (1 each for ADD/SUB/MUL/DIV) allowing for individual tuning of these locally.

Local run of specfun at my desk revealed errors only in test_igamma_inv.cpp only fr extreme small/large values and only on GCC.

Cc: @sinandredemption and @cosurgi

ckormanyos commented 1 year ago

Ugggghhh. I need to fix something.

ckormanyos commented 1 year ago

OK. That's more like it! We are back to green on most tests.

The run on specfun shows two files only with errors. These include the known impossible test-case for cyp_bessel_k() and many NaN-values (possibly propagated infinities) for extreme valus in the test_igamma_inv.cpp test file.

Aside from the fact that this run switches back to the Briggs-style algorithms, there is seemingly only one kind of error remaining. These are many but similar erros in specfun on test_igamma_inv.cpp.

Assuming we hammer these in (whenever we solve the last remaining edge problems), we will finally have a working, but very new and very preliminary cpp_double_fp<>.

Getting close to a preliminary state...

Cc: @sinandredemption and @cosurgi

ckormanyos commented 1 year ago

Hi Fahad (@sinandredemption) please note that when I change to the Briggs algorithms, there is no real algorithmic reason to do this. I simply found empirically that fewer errors were getting propogated. If the algorithms add/sub/mul/div are all "well behaved" and catch all infinities, zeros, NaNs and subnormals, no problems are anticipated.

We just seem to be experiencing difficulties getting to that state.

Once we achieve all green, we can optimize the algos one at a time "under the microscope".

Cc: @cosurgi

ckormanyos commented 1 year ago

I will commit this with small outstanding issues in specfun and potentially non-permanent use of Briggs-style algorithms.

The intent is to move forware dnd finally go green on all tests, functions, limits, and even specfun. Then we can optimize after that.

Cc: @sinandredemption and @cosurgi