math constants
Ed Smith-Rowland
3dw4rd@verizon.net
Wed Feb 6 23:12:00 GMT 2013
On 02/06/2013 03:12 PM, Ulrich Drepper wrote:
> On Tue, Feb 5, 2013 at 9:32 AM, Ed Smith-Rowland <3dw4rd@verizon.net> wrote:
>> I just remembered I found it necessary to add math constants for the old TR1
>> math functions.
>>
>> If you look at include/tr1/special_function_util.h I had a
>> floating_point_constant template in analogy to the standard
>> integral_constant.
>> Then I added a bunch of math constants. So we have some prior art in this.
>>
>> I would be in strong support of a fully standard solution along these lines.
> You really mean that the current form is what you prefer? Why
> functions? Why not constexpr? You named numeric_constants after
> numeric_limits but it's implemented differently.
>
Ulrich,
Sorry, I like your constexpr solution. I forgot to write that in my
missive. These TR1 constants were pre-constexpr and are needed to work
in pre-C++11 mode in any case. I meant only that I had to move beyond
the double-only constants in math.h.
Go with you idea and good luck.
Also, in a sort of related subject, I would like global functions that
return numeric_limits things. I want this to support, generically,
numeric algorithms that might take, say, multi-precision reals and big
integers that might have different behaviors and sizes depending on how
they are constructed. Obviously these would refer to numeric_limits for
primitive types. What do you all think?
Ed
More information about the Libstdc++
mailing list