@@ -11,11 +11,34 @@ pub use exponential::{exp, log, log10, sqrt};
1111pub use misc:: { abs, isclose, isfinite, isinf, isnan, phase, polar, rect} ;
1212pub use trigonometric:: { acos, acosh, asin, asinh, atan, atanh, cos, cosh, sin, sinh, tan, tanh} ;
1313
14+ use num_complex:: Complex64 ;
15+
16+ // Public constants (matching Python's cmath module)
17+
18+ /// The mathematical constant e = 2.718281...
19+ pub const E : f64 = std:: f64:: consts:: E ;
20+
21+ /// The mathematical constant π = 3.141592...
22+ pub const PI : f64 = std:: f64:: consts:: PI ;
23+
24+ /// The mathematical constant τ = 6.283185...
25+ pub const TAU : f64 = std:: f64:: consts:: TAU ;
26+
27+ /// Positive infinity.
28+ pub const INF : f64 = f64:: INFINITY ;
29+
30+ /// A floating point "not a number" (NaN) value.
31+ pub const NAN : f64 = f64:: NAN ;
32+
33+ /// Complex number with zero real part and positive infinity imaginary part.
34+ pub const INFJ : Complex64 = Complex64 :: new ( 0.0 , f64:: INFINITY ) ;
35+
36+ /// Complex number with zero real part and NaN imaginary part.
37+ pub const NANJ : Complex64 = Complex64 :: new ( 0.0 , f64:: NAN ) ;
38+
1439#[ cfg( test) ]
1540use crate :: Result ;
1641use crate :: m;
17- #[ cfg( test) ]
18- use num_complex:: Complex64 ;
1942
2043// Shared constants
2144
@@ -25,8 +48,6 @@ const M_LN2: f64 = core::f64::consts::LN_2;
2548const CM_LARGE_DOUBLE : f64 = f64:: MAX / 4.0 ;
2649const CM_LOG_LARGE_DOUBLE : f64 = 709.0895657128241 ; // log(CM_LARGE_DOUBLE)
2750
28- const INF : f64 = f64:: INFINITY ;
29-
3051// Special value table constants
3152const P : f64 = core:: f64:: consts:: PI ;
3253const P14 : f64 = 0.25 * core:: f64:: consts:: PI ;
0 commit comments