问题标签 [math.h]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
c++ - C++ Windows 替代 lrint?
windows中C99 lrint函数的正确替代方法是什么?
那是对的吗?
c - c等价于matlab的sind和cosd函数
所以我正在使用一些matlab代码手动转换为c代码。我只是想知道是否有 ac 等效于我在 matlab 代码中看到的 sind 和 cosd 函数。我想这会以度数而不是 c sin 和 cos 函数以弧度返回结果。我想我可以将结果乘以 180/pi 但只是想知道 math.h 中是否有库函数我没有看到。或者即使 gsl 库中有一些东西可以做到这一点。
sse - SSE 和 AVX 的 SIMD 数学库
我正在寻找 SSE 和 AVX 的 SIMD 数学库(最好是开源的)。我的意思是,例如,如果我有一个带有 8 个浮点值的 AVX 寄存器 v,我希望 sin(v) 一次返回所有八个值的 sin。
AMD 有一个专有库 LibM http://developer.amd.com/tools/cpu-development/libm/,它有一些 SIMD 数学函数,但 LibM 只有在检测到英特尔 CPU 没有的 FMA4 时才使用 AVX。此外,我不确定它是否完全使用 AVX,因为所有函数名称都以 s4 (d2) 而不是 s8 (d4) 结尾。它比 Intel CPU 上的标准数学库提供更好的性能,但也好不了多少。
英特尔将 SVML 作为其 C++ 编译器的一部分,但编译器套件在 Windows 上非常昂贵。此外,英特尔会削弱非英特尔 CPU 上的库。
我找到了以下 AVX 库http://software-lisc.fbk.eu/avx_mathfun/,它支持一些数学函数(exp、log、sin、cos 和 sincos)。它为我提供了非常快的结果,比 SVML 更快,但我没有检查准确性。它仅适用于单浮点,在 Visual Studio 中不起作用(尽管这很容易修复)。它基于另一个 SSE 库。
有没有人有任何其他建议?
编辑:我找到了一个 SO 线程,它在 C 中对这个主题 Vectorized Trig 函数有很多答案?
c++11 - 如果没有定义 tgamma() 函数怎么办?
我正在尝试tgamma()
从标准库中使用。当我尝试编译时,我收到错误消息:
调用未定义的函数 tgamma
我有指令#include <cmath>
。我使用 Embarcadero C++ Builder XE3,它声称支持 C++11 标准。什么可能是我的问题,以及如何解决它?
c++builder - Math functions undefined although present in the Borland C++ Builder 6 help under Math unit
I want to use the function Sign() in a Borland C++ Builder 6 application. I cannot however find the correct header file.
When I use this function I get a compiler error saying undefined symbol, Sign.
You would think this function would be in math.h but I can't find it there. It shows up in the help list (Unit : Math).
I saw some threads for similar missing function definition (stddev for example). A solution was to add the option -lm or -lc to the compiler. But how to configure it in Borland C++ Builder graphical interface for compiling options ?
c++ - 开发 C,math.h 问题
我刚刚安装了 devcpp,并试图确保它正常工作。当我遇到围绕 math.h 的编译错误时。我正在使用一些之前已经编译和运行过的简单程序,所以那里应该没有任何问题。我通常会改用 cmath,但我也需要使用 Magick++ 来处理一些事情,它使用 math.h。有人遇到过这个吗?知道解决方法吗?
错误是
math.h 的第 594 行在 '(' 标记之前应为 ')'
math.h 的第 594 行预期为 ',' 或 ';' 在 '(' 标记之前
'abs' 未声明
第 594 行
在上下文中
c - 如何使用 clang 编译带有 math.h 的 c 文件?
输出:/tmp/a4-4oU730.o:在函数 sqrt'clang:main':
a4.c:(.text+0x4f): undefined reference to
错误:链接器命令失败,退出代码为 1(使用 -v 查看调用)
c - 使用 C math.h 计算数字的 sin
我是 C 的绝对初学者,我读过几本书,但从未真正玩过它。我开始尝试使用一个非常简单的程序来应用我所读到的内容,该程序返回一个数字的罪。我在 C 中遇到的最困难的事情是知道如何以及何时使用指针。
我确定这很简单,但这是我编写测试的方式:
我正在 Ubuntu 中编译和执行这段代码
我收到的错误是这样的:
c - 在 C 中使用 sqrtf():“未定义对 `sqrtf' 的引用”
我正在使用 Linux、Ubuntu 12.04(Precise Pangolin)和 Geany 进行编码。在我使用 sqrtf 命令找到浮点数的平方根之前,我用 C 编写的代码运行良好。
错误:HAC3.c:(.text+0xfd7): undefined reference to `sqrtf' 。
我在以下代码中使用 sqrtf() 的部分代码:
我包括了 math.h,但这似乎不是问题。
有没有办法修复 Geany,这样就不会再出现了?