std::fmodf 在 C++11 标准中的什么地方声明?

Where in the C++11 standard is std::fmodf stated?

根据 cppref page,std::fmodf 在 C++11 中被添加到 cmath。这怎么可能,因为这不意味着 cmath 会破坏与 C++11 之前的 math.h 的兼容性吗?我找不到任何说 std::fmodf 被添加到 C++11 中的参考资料,我想知道这是在哪里声明的。

谢谢

Where in the C++11 standard is std::fmodf stated?

它没有直接提到(尽管它可能应该在函数列表中提到,或者明确省略)。导致 std::fmodf 存在的变化在这里(引自草案 N3337):

The following referenced documents are indispensable for the application of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.

  • ...
  • ISO/IEC 9899:1999, Programming languages — C
  • ...

通过以下规则:

[c.math]

The contents of these headers are the same as the Standard C library headers <math.h> and <stdlib.h> respectively, with the following changes: ...

C99 添加了 fmodf。它是在C++11开始引用C99的标准库而不是C89时继承给C++的。

请注意,“以下更改”未列出遗漏的fmodf


Why isn't fmodf listed in the list of functions (26.8/3 and 26.8/9)? It was added to the list in the C++17 standard.

这似乎是一个编辑错误。它似乎已在 C++17 中由 P0175 修复,建议:

In this editorial paper we propose to add to the working draft the complete synopses of the C library headers that are included in C++ by reference to the C standard (see Table 15). These synopses will replace the various tables captioned “Header synopsis”.


旁注:std::fmodf 在 C++ 中相当无用,因为您可以简单地使用 std::fmod 代替,并且自 C++98 以来就已经存在。