regards
Gero
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
https://github.com/boostorg/math/issues/506
On Thursday, January 28, 2021, 12:55:59 PM GMT+1, Gero Peterhoff via Boost <bo...@lists.boost.org> wrote:
regards
Gero
Yes. I am trying a patch that handles zero explicitly.I'm not quite sure if all zeros, NaNs and Infinitiesare correct yet,... But the patch is generallymoving toward the fix shown in the link below...
If you get a chance, could you try that patchfrom the branch linked below?
Kind regards, Chris
Thoughts?
Kind regards, Chris
> I also noticed a few basic things,> maybe you can say why that is:> - Why are there explicit complex classes> for FP types, why is this not implemented> completely via template? The advantage is> that built-ins can be used, on the other hand,> a separate class must be written for each> FP type - with the problems we are currently having.> - Why are there missing template conversion> ctors for the complex<FP-Type>? That will not do:> std::complex<int> ci{4711, 23};
> std::complex<double> cd=ci;
> or
> std::complex<double> cd = std::complex<double>{ci};
> but a ctor must be called explicitly
> std::complex<double> cd=std::complex<double>{double(ci.real()), double(ci.imag())}; // prevent warnings
> It's really annoying.
> - Why are many std-math functions missing> for complex; special-functions complete> (also applies to std::valarray)?
> I want to add such things in my math-lib,> as far as possible everything constexpr...
These are good questions and valid points.The files in question were written in 2013/14.In time since passed, we have two major changesincluding Multiprecision's own 128-bitfloat class and a complex adapter.
What need to do here is find out whatis thoday's proper niche for <cstdfloat.hpp>?And how can it be made more corrector less wrong, or more standards compliant,or however you want to put it?
I will look into a potential larger refactor.A lot of this action will get too in-depthfor the board. Tracking of any significantprogress will probably be handled on theGitHub platform.
Kind regards
The place to check for this is C99 Annex G - but note that this is
non-normative so there will be implementations of std::complex which do
not do anything in particular in these cases... platforms too with no
infinity or NaN.
> But I saw that gcc libquadmath (https://gcc.gnu.org/onlinedocs/libquadmath/Math-Library-Routines.html#Math-Library-Routines) offers some complex functions that work correctly. These could be used. But I don't know if clang, intel and/or other compilers can do that too.
> example
> inline complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE> log(const complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>& x)
> {
> __complex128
> res = __complex128{x.real(), x.imag()};
> res = clogq(res);
> return complex<BOOST_CSTDFLOAT_EXTENDED_COMPLEX_FLOAT_TYPE>{crealq(res), cimagq(res)};
> }
>
> I also noticed a few basic things, maybe you can say why that is:
> - Why are there explicit complex classes for FP types, why is this not implemented completely via template? The advantage is that built-ins can be used, on the other hand, a separate class must be written for each FP type - with the problems we are currently having.
This is all a question for the C++ committee, my speculation would be
that they wished to restrict the scope of std::complex to
float/double/long double.
> - Why are there missing template conversion ctors for the complex<FP-Type>? That will not do:
> std::complex<int> ci{4711, 23};
> std::complex<double> cd=ci;
> or
> std::complex<double> cd = std::complex<double>{ci};
> but a ctor must be called explicitly
> std::complex<double> cd=std::complex<double>{double(ci.real()), double(ci.imag())}; // prevent warnings
> It's really annoying.
> - Why are many std-math functions missing for complex; special-functions complete (also applies to std::valarray)?
>
> I want to add such things in my math-lib, as far as possible everything constexpr. I also want to provide additional classes for dual and splitcomplex numbers (i²=0, i²=1, but it is far from complete - because it is quite extensive). Maybe these could also be included in boost. To do this, however, it would be necessary to convert the boost-math-lib to C++20, since some functions (or the distinction between dual, complex and splitcomplex - classes/functions) is only possible with concepts (otherwise unreasonable effort). I also need some additional typetraits.
If you want to provide implementations for any complex valued special
functions we can take care of the algorithm overload selection -
enable_if will do fine, there's no need for concepts just yet.
Best John.
--
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
I refer you to https://wg21.link/complex.numbers p2, which states:
The effect of instantiating the template complex for any type other than float, double, or long double is unspecified.
— Marshall
Thanks for getting the ball rollingon this and kind regards, Chris
I will note that there is a proposal that might alter this stance:
Personally, I would really enjoyto see floatN_t in C/C++ world. I was notaware of this particular proposal, which does,in fact, mention, revive and extend previous,partial (yet stalled) work by Bristow, Maddockand myself --- Floating-Point Typedefs HavingSpecified Widths - N1703.
In fact, the preliminary work in
https://github.com/boostorg/math/tree/develop/include/boost/math/cstdfloat
(which contains the original topic of this thread) attempts to providea sensible working model for floatN_t.
If ever desired to better align Boost withhttps://wg21.link/P1467R4as it progresses, please feel free to contactus (or me) in the future.
Kind regards, Chris
The state of that issue is *open*, which means,unfortunately, that I have not yet fixed it.
The intent is to gather outstanding relatedpoints, bug-lets and the like and fix theseen-masse in a more dedicated driveforward.
The time for me to drive forward on thisis rapidly approaching. The deal is that1.76 was full of many larger organizationsland code-technical efforts in both Mathas well as Multiprecision, followed bycontinued cleanup to this very day.
Forward mothion on this issue is plannedforthcoming.
kind regards, Chris
thx
Gero
_______________________________________________
On Sunday, April 18, 2021, 8:08:39 PM GMT+2, Gero Peterhoff <g.pet...@t-online.de> wrote:
thx
Gero
_______________________________________________
Hi Gero. Thanks for responding and pleaseaccept my apologies for the late response.
The short answer to the queries above andsuggestions from your side, having muchdepth and information is that i plan toimprove (via refactor) for 1.77.
This is the only actual issue in Boostthat I have assigned to myself rightnow. I took some time to clean upsome projects in other domains,but expect to re-open work on thisissue shortly.
Kind regards, Chris
quarter=0.25
thx
Gero
_______________________________________________
Kind regards, Chris
quarter=0.25
thx
Gero
_______________________________________________