python源程序是什么_python – 在Numpy源代码中定义的常量是什么?

/numpy/core/include/numpy/npy_math.h中定义了许多常量

目前定义的是(从第48行开始):

#define NPY_INFINITYF __npy_inff()

#define NPY_NANF __npy_nanf()

#define NPY_PZEROF __npy_pzerof()

#define NPY_NZEROF __npy_nzerof()

#define NPY_INFINITY ((npy_double)NPY_INFINITYF)

#define NPY_NAN ((npy_double)NPY_NANF)

#define NPY_PZERO ((npy_double)NPY_PZEROF)

#define NPY_NZERO ((npy_double)NPY_NZEROF)

#define NPY_INFINITYL ((npy_longdouble)NPY_INFINITYF)

#define NPY_NANL ((npy_longdouble)NPY_NANF)

#define NPY_PZEROL ((npy_longdouble)NPY_PZEROF)

#define NPY_NZEROL ((npy_longdouble)NPY_NZEROF)

/*

* Useful constants

*/

#define NPY_E 2.718281828459045235360287471352662498 /* e */

#define NPY_LOG2E 1.442695040888963407359924681001892137 /* log_2 e */

#define NPY_LOG10E 0.434294481903251827651128918916605082 /* log_10 e */

#define NPY_LOGE2 0.693147180559945309417232121458176568 /* log_e 2 */

#define NPY_LOGE10 2.302585092994045684017991454684364208 /* log_e 10 */

#define NPY_PI 3.141592653589793238462643383279502884 /* pi */

#define NPY_PI_2 1.570796326794896619231321691639751442 /* pi/2 */

#define NPY_PI_4 0.785398163397448309615660845819875721 /* pi/4 */

#define NPY_1_PI 0.318309886183790671537767526745028724 /* 1/pi */

#define NPY_2_PI 0.636619772367581343075535053490057448 /* 2/pi */

#define NPY_EULER 0.577215664901532860606512090082402431 /* Euler constant */

#define NPY_SQRT2 1.414213562373095048801688724209698079 /* sqrt(2) */

#define NPY_SQRT1_2 0.707106781186547524400844362104849039 /* 1/sqrt(2) */

#define NPY_Ef 2.718281828459045235360287471352662498F /* e */

#define NPY_LOG2Ef 1.442695040888963407359924681001892137F /* log_2 e */

#define NPY_LOG10Ef 0.434294481903251827651128918916605082F /* log_10 e */

#define NPY_LOGE2f 0.693147180559945309417232121458176568F /* log_e 2 */

#define NPY_LOGE10f 2.302585092994045684017991454684364208F /* log_e 10 */

#define NPY_PIf 3.141592653589793238462643383279502884F /* pi */

#define NPY_PI_2f 1.570796326794896619231321691639751442F /* pi/2 */

#define NPY_PI_4f 0.785398163397448309615660845819875721F /* pi/4 */

#define NPY_1_PIf 0.318309886183790671537767526745028724F /* 1/pi */

#define NPY_2_PIf 0.636619772367581343075535053490057448F /* 2/pi */

#define NPY_EULERf 0.577215664901532860606512090082402431F /* Euler constan*/

#define NPY_SQRT2f 1.414213562373095048801688724209698079F /* sqrt(2) */

#define NPY_SQRT1_2f 0.707106781186547524400844362104849039F /* 1/sqrt(2) */

#define NPY_El 2.718281828459045235360287471352662498L /* e */

#define NPY_LOG2El 1.442695040888963407359924681001892137L /* log_2 e */

#define NPY_LOG10El 0.434294481903251827651128918916605082L /* log_10 e */

#define NPY_LOGE2l 0.693147180559945309417232121458176568L /* log_e 2 */

#define NPY_LOGE10l 2.302585092994045684017991454684364208L /* log_e 10 */

#define NPY_PIl 3.141592653589793238462643383279502884L /* pi */

#define NPY_PI_2l 1.570796326794896619231321691639751442L /* pi/2 */

#define NPY_PI_4l 0.785398163397448309615660845819875721L /* pi/4 */

#define NPY_1_PIl 0.318309886183790671537767526745028724L /* 1/pi */

#define NPY_2_PIl 0.636619772367581343075535053490057448L /* 2/pi */

#define NPY_EULERl 0.577215664901532860606512090082402431L /* Euler constan*/

#define NPY_SQRT2l 1.414213562373095048801688724209698079L /* sqrt(2) */

#define NPY_SQRT1_2l 0.707106781186547524400844362104849039L /* 1/sqrt(2) */

这些常数也记录在here中

Starting from numpy 1.3.0, we are working on separating the pure C, “computational” code from the python dependent code. The goal is twofolds: making the code cleaner, and enabling code reuse by other extensions outside numpy (scipy, etc…).

The numpy core math library (‘npymath’) is a first step in this direction. This library contains most math-related C99 functionality, which can be used on platforms where C99 is not well supported. The core math functions have the same API as the C99 ones, except for the npy_* prefix.

The available functions are defined in – please refer to this header when in doubt.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值