Date: Thu, 24 Oct 2024 17:21:29 -0400
AFAIK precise semantics of floating point operations and how the floating point types are implemented is implementation defined, and typically defers to some floating point standard.
If your C++ implementation (compiler) implements ISO/IEC 60559 floating point arithmetic, which is almost always the case, then all operations on floating point types, wether builtin or from Numerics Library (cmath, complex, etc) are defined in that standard. Support for ISO/IEC 60559 can be queried in numeric_limits.
Julien V.
On August 27, 2024 6:35:50 a.m. EDT, Joachim Wuttke via Std-Discussion <std-discussion_at_[hidden]> wrote:
>Do I see correctly that the standard says
>nothing about the precision of mathematical
>functions provided by <cmath>?
>
>Why not?
>
>Could this change in the future?
>
>What is the point of adding ever more functions
>to <cmath> (like Bessel functions in c++17) if
>this comes without any guarantee of accuracy?
>As a user, I was better off depending on
>a dedicated third-party library than relying on
>a poor implementation in the C++ standard lib.
>
>---
>
>Dr. Joachim Wuttke
>group leader Scientific Computing
>Forschungszentrum Jülich GmbH
>Jülich Centre for Neutron Science at MLZ
>+49 89 158860 715
>https://computing.mlz-garching.de
>https://jugit.fz-juelich.de/mlz
If your C++ implementation (compiler) implements ISO/IEC 60559 floating point arithmetic, which is almost always the case, then all operations on floating point types, wether builtin or from Numerics Library (cmath, complex, etc) are defined in that standard. Support for ISO/IEC 60559 can be queried in numeric_limits.
Julien V.
On August 27, 2024 6:35:50 a.m. EDT, Joachim Wuttke via Std-Discussion <std-discussion_at_[hidden]> wrote:
>Do I see correctly that the standard says
>nothing about the precision of mathematical
>functions provided by <cmath>?
>
>Why not?
>
>Could this change in the future?
>
>What is the point of adding ever more functions
>to <cmath> (like Bessel functions in c++17) if
>this comes without any guarantee of accuracy?
>As a user, I was better off depending on
>a dedicated third-party library than relying on
>a poor implementation in the C++ standard lib.
>
>---
>
>Dr. Joachim Wuttke
>group leader Scientific Computing
>Forschungszentrum Jülich GmbH
>Jülich Centre for Neutron Science at MLZ
>+49 89 158860 715
>https://computing.mlz-garching.de
>https://jugit.fz-juelich.de/mlz
Received on 2024-10-24 21:23:49