@@ -3,7 +3,7 @@ use pyo3::{Python, prelude::*};
33
44/// Edge values for testing floating-point functions.
55/// Includes: zeros, infinities, various NaNs, subnormals, and values at different scales.
6- pub ( crate ) const EDGE_VALUES : [ f64 ; 30 ] = [
6+ pub ( crate ) const EDGE_VALUES : [ f64 ; 64 ] = [
77 // Zeros
88 0.0 ,
99 -0.0 ,
@@ -15,35 +15,79 @@ pub(crate) const EDGE_VALUES: [f64; 30] = [
1515 -f64:: NAN ,
1616 // Additional NaN with different payload (quiet NaN with payload 1)
1717 f64:: from_bits ( 0x7FF8_0000_0000_0001_u64 ) ,
18+ // Signaling NaN (sNaN) - may trigger FP exceptions on some platforms
19+ f64:: from_bits ( 0x7FF0_0000_0000_0001_u64 ) ,
1820 // Subnormal (denormalized) values
19- f64:: MIN_POSITIVE * 0.5 , // smallest subnormal
21+ f64:: MIN_POSITIVE * 0.5 ,
2022 -f64:: MIN_POSITIVE * 0.5 ,
23+ 5e-324 ,
24+ -5e-324 ,
2125 // Boundary values
22- f64:: MIN_POSITIVE , // smallest positive normal
23- f64:: MAX , // largest finite
24- f64:: MIN , // most negative finite (not smallest!)
26+ f64:: MIN_POSITIVE ,
27+ f64:: MAX ,
28+ f64:: MIN ,
2529 // Near-infinity large values
2630 f64:: MAX * 0.5 ,
2731 -f64:: MAX * 0.5 ,
2832 1e308 ,
2933 -1e308 ,
34+ // Overflow/underflow thresholds for exp
35+ 710.0 ,
36+ -745.0 ,
3037 // Small scale
3138 1e-10 ,
3239 -1e-10 ,
3340 1e-300 ,
41+ -1e-300 ,
3442 // Normal scale
3543 1.0 ,
3644 -1.0 ,
3745 0.5 ,
3846 -0.5 ,
3947 2.0 ,
40- // Trigonometric special values (where sin/cos/tan have exact or near-zero results)
41- std:: f64:: consts:: PI , // sin(PI) ≈ 0
48+ -2.0 ,
49+ 3.0 , // for cbrt
50+ -3.0 ,
51+ // Values near 1.0 (log, expm1, log1p, acosh boundary)
52+ 1.0 - 1e-15 ,
53+ 1.0 + 1e-15 ,
54+ f64:: EPSILON ,
55+ 1.0 - f64:: EPSILON ,
56+ 1.0 + f64:: EPSILON ,
57+ // asin/acos domain boundaries [-1, 1]
58+ 1.0000000000000002 , // just outside domain (1 + eps)
59+ -1.0000000000000002 ,
60+ // atanh domain boundaries (-1, 1)
61+ 0.9999999999999999 , // just inside domain
62+ -0.9999999999999999 ,
63+ // log1p domain boundary (> -1)
64+ -0.9999999999999999 , // just above -1
65+ -1.0 + 1e-15 , // very close to -1
66+ // gamma/lgamma poles (negative integers)
67+ -1.0 ,
68+ -2.0 ,
69+ -3.0 ,
70+ -0.5 , // gamma(-0.5) = -2*sqrt(pi)
71+ // Mathematical constants
72+ std:: f64:: consts:: E ,
73+ std:: f64:: consts:: LN_2 ,
74+ std:: f64:: consts:: LOG10_E ,
75+ // Trigonometric special values
76+ std:: f64:: consts:: PI ,
4277 -std:: f64:: consts:: PI ,
43- std:: f64:: consts:: FRAC_PI_2 , // cos(PI/2) ≈ 0
78+ std:: f64:: consts:: FRAC_PI_2 ,
4479 -std:: f64:: consts:: FRAC_PI_2 ,
45- std:: f64:: consts:: FRAC_PI_4 , // tan(PI/4) = 1
46- std:: f64:: consts:: TAU , // sin(2*PI) ≈ 0, cos(2*PI) = 1
80+ std:: f64:: consts:: FRAC_PI_4 ,
81+ std:: f64:: consts:: TAU ,
82+ 1.5 * std:: f64:: consts:: PI , // 3π/2
83+ // Large values for trig (precision loss)
84+ 1e15 ,
85+ -1e15 ,
86+ // Near-integer values (ceil, floor, trunc, round)
87+ 0.49999999999999994 ,
88+ 0.50000000000000006 ,
89+ -0.49999999999999994 ,
90+ -0.50000000000000006 ,
4791] ;
4892
4993pub ( crate ) fn unwrap < ' py > (
0 commit comments