c++ - Visual Studio 是否提供 C 库的 isnormal()?

标签 c++ visual-studio-2013

我正在使用 Visual Studio Express 2013 构建 C++ 库。我想调用 the isnormal function来自 cmath,但 VS 库似乎只有 _isnan_finite(它们在 cfloat 中,不是 cmath)。

它还提供了 _fpclass,我假设它对应于 fpclassify .以下宏是否适合替代 isnormal

#ifdef _WIN32
#define isnormal(x) (_fpclass(x) == _FPCLASS_NN || _fpclass(x) == _FPCLASS_PN)
#endif

最佳答案

根据 this blog post isnormal至少出现在 MSVC2013 的 <math.h> 中.因此,在 <cmath>应该找到对应的std::isnormal (您记得使用命名空间 std,对吧?)。否则,您将不得不回退到 C header 。

(或者可能修复/更新您的 MSVC 安装 - MGetz 的评论显示他的 VS2013 Express 安装有 std::isnormal )

关于c++ - Visual Studio 是否提供 C 库的 isnormal()?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23112779/

相关文章:

c++ - 使用 std::vector 的开销?

c++ - Auto_ptr 到外部 C 结构

asp.net-mvc - 在新的 ASP.NET MVC 5 项目中更新 NuGet 包引用后,如何修复与 JSON.NET 的程序集版本冲突?

android - 失败 [INSTALL_FAILED_UPDATE_INCOMPATIBLE] 即使应用似乎没有安装

C++ CMenu 绘图不正确(非自定义)

vb.net - 为什么我的通用列表中的每个元素都相同? (VB)

c++ - Qt - 在 TableView 中自动组合框?

c++ - 在 ICMP 报头校验和计算中?

c++ - 将通用结构作为接口(interface)中的参数传递

c++ - 错误 C2732 : linkage specification contradicts earlier specification for 'log'