Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9f69bfc

Browse files
committed
Add sqrt(2) and 1/sqrt(2) math constants in npymath.
1 parent 41366bc commit 9f69bfc

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

numpy/core/include/numpy/npy_math.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ NPY_INLINE static float __npy_nzerof(void)
6363
#define NPY_1_PI 0.3183098861837906715377675267450287 /* 1/pi */
6464
#define NPY_2_PI 0.6366197723675813430755350534900574 /* 2/pi */
6565
#define NPY_EULER 0.5772156649015328606065120900824024 /* Euler constant */
66+
#define NPY_SQRT2 1.41421356237309504880168872420969808 /* sqrt(2) */
67+
#define NPY_SQRT1_2 0.707106781186547524400844362104849039 /* 1/sqrt(2) */
6668

6769
#define NPY_Ef 2.7182818284590452353602874713526625F /* e */
6870
#define NPY_LOG2Ef 1.4426950408889634073599246810018921F /* log_2 e */
@@ -75,6 +77,8 @@ NPY_INLINE static float __npy_nzerof(void)
7577
#define NPY_1_PIf 0.3183098861837906715377675267450287F /* 1/pi */
7678
#define NPY_2_PIf 0.6366197723675813430755350534900574F /* 2/pi */
7779
#define NPY_EULERf 0.5772156649015328606065120900824024F /* Euler constant */
80+
#define NPY_SQRT2f 1.41421356237309504880168872420969808F /* sqrt(2) */
81+
#define NPY_SQRT1_2f 0.707106781186547524400844362104849039F /* 1/sqrt(2) */
7882

7983
#define NPY_El 2.7182818284590452353602874713526625L /* e */
8084
#define NPY_LOG2El 1.4426950408889634073599246810018921L /* log_2 e */
@@ -87,6 +91,8 @@ NPY_INLINE static float __npy_nzerof(void)
8791
#define NPY_1_PIl 0.3183098861837906715377675267450287L /* 1/pi */
8892
#define NPY_2_PIl 0.6366197723675813430755350534900574L /* 2/pi */
8993
#define NPY_EULERl 0.5772156649015328606065120900824024L /* Euler constant */
94+
#define NPY_SQRT2l 1.41421356237309504880168872420969808L /* sqrt(2) */
95+
#define NPY_SQRT1_2l 0.707106781186547524400844362104849039L /* 1/sqrt(2) */
9096

9197
/*
9298
* C99 double math funcs

0 commit comments

Comments
 (0)