C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Extensible Math Functions for C++

From: Lénárd Szolnoki <cpp_at_[hidden]>
Date: Thu, 02 Apr 2026 07:59:08 +0100
On 2 April 2026 06:14:10 BST, Jan Schultke via Std-Proposals <std-proposals_at_[hidden]> wrote:
>While the idea is is worth pursuing, extensible math functions would be a
>lot of design work that cuts horizontally across several proposals:
>
> - P3935R0 "Rebasing <cmath> on C23" adds many more mathematical
> functions.
> - P3045R7 "Quantities and units library" also mentions mathematical
> functions that operate on quantities.
> - I forgot the number ... we had a proposal that lets you explicitly
> specify rounding modes for math functions I believe.
>
>I suspect that if we were to add quantities and units to the standard
>library, then new mathematical functions will be part of that library in
>some way. Being able to std::floor a second or meter or something is a
>major motivating use case. You should get in touch with the authors and see
>how much overlap there is.

The last thing I want is a single argument std::floor that silently returns semantically different quantities when called with meters or centimeters.

I'm fine with pow and sqrt (which is a special case), but not a lot of other math functions are viable outside of dimensionless quantities.

>
>On Wed, 1 Apr 2026 at 23:19, Stéphane Gros-Lemesre via Std-Proposals <
>std-proposals_at_[hidden]> wrote:
>
>> Hello,
>> It is my first time posting here, I'm not sure I am following the proper
>> process. Please let me know if I'm doing this wrong.
>>
>> I wanted to float here this idea, see if there would be interest.
>> The idea is providing an extension mechanism for std math functions.
>>
>> The idea is presented here:
>> https://github.com/StephaneGrosLemesre/ExtensibleMath
>>
>> Or in the attached pdf.
>>
>> Please let me know what you think,
>> Kind regards,
>> Stéphane
>> --
>> Std-Proposals mailing list
>> Std-Proposals_at_[hidden]
>> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>>

Received on 2026-04-02 06:59:18