@@ -78,7 +78,8 @@ impl<F: Float> Domain<F> {
78
78
const STRICTLY_POSITIVE : Self =
79
79
Self { start : Bound :: Excluded ( F :: ZERO ) , end : Bound :: Unbounded , check_points : None } ;
80
80
81
- const fn into_prim_f < I > ( self ) -> EitherPrim < Self , Domain < I > > {
81
+ /// Wrap in the float variant of [`EitherPrim`].
82
+ const fn into_prim_float < I > ( self ) -> EitherPrim < Self , Domain < I > > {
82
83
EitherPrim :: Float ( self )
83
84
}
84
85
}
@@ -89,7 +90,8 @@ impl<I: Int> Domain<I> {
89
90
const UNBOUNDED_INT : Self =
90
91
Self { start : Bound :: Unbounded , end : Bound :: Unbounded , check_points : None } ;
91
92
92
- const fn into_prim_i < F > ( self ) -> EitherPrim < Domain < F > , Self > {
93
+ /// Wrap in the int variant of [`EitherPrim`].
94
+ const fn into_prim_int < F > ( self ) -> EitherPrim < Domain < F > , Self > {
93
95
EitherPrim :: Int ( self )
94
96
}
95
97
}
@@ -99,65 +101,65 @@ impl<F: Float, I: Int> EitherPrim<Domain<F>, Domain<I>> {
99
101
/// x ∈ ℝ
100
102
const UNBOUNDED1 : [ Self ; 1 ] =
101
103
[ Domain { start : Bound :: Unbounded , end : Bound :: Unbounded , check_points : None }
102
- . into_prim_f ( ) ] ;
104
+ . into_prim_float ( ) ] ;
103
105
104
106
/// {x1, x2} ∈ ℝ
105
107
const UNBOUNDED2 : [ Self ; 2 ] =
106
- [ Domain :: UNBOUNDED . into_prim_f ( ) , Domain :: UNBOUNDED . into_prim_f ( ) ] ;
108
+ [ Domain :: UNBOUNDED . into_prim_float ( ) , Domain :: UNBOUNDED . into_prim_float ( ) ] ;
107
109
108
110
/// {x1, x2, x3} ∈ ℝ
109
111
const UNBOUNDED3 : [ Self ; 3 ] = [
110
- Domain :: UNBOUNDED . into_prim_f ( ) ,
111
- Domain :: UNBOUNDED . into_prim_f ( ) ,
112
- Domain :: UNBOUNDED . into_prim_f ( ) ,
112
+ Domain :: UNBOUNDED . into_prim_float ( ) ,
113
+ Domain :: UNBOUNDED . into_prim_float ( ) ,
114
+ Domain :: UNBOUNDED . into_prim_float ( ) ,
113
115
] ;
114
116
115
117
/// {x1, x2} ∈ ℝ, one float and one int
116
118
const UNBOUNDED_F_I : [ Self ; 2 ] =
117
- [ Domain :: UNBOUNDED . into_prim_f ( ) , Domain :: UNBOUNDED_INT . into_prim_i ( ) ] ;
119
+ [ Domain :: UNBOUNDED . into_prim_float ( ) , Domain :: UNBOUNDED_INT . into_prim_int ( ) ] ;
118
120
119
121
/// x ∈ ℝ >= 0
120
- const POSITIVE : [ Self ; 1 ] = [ Domain :: POSITIVE . into_prim_f ( ) ] ;
122
+ const POSITIVE : [ Self ; 1 ] = [ Domain :: POSITIVE . into_prim_float ( ) ] ;
121
123
122
124
/// x ∈ ℝ > 0
123
- const STRICTLY_POSITIVE : [ Self ; 1 ] = [ Domain :: STRICTLY_POSITIVE . into_prim_f ( ) ] ;
125
+ const STRICTLY_POSITIVE : [ Self ; 1 ] = [ Domain :: STRICTLY_POSITIVE . into_prim_float ( ) ] ;
124
126
125
127
/// Used for versions of `asin` and `acos`.
126
128
const INVERSE_TRIG_PERIODIC : [ Self ; 1 ] = [ Domain {
127
129
start : Bound :: Included ( F :: NEG_ONE ) ,
128
130
end : Bound :: Included ( F :: ONE ) ,
129
131
check_points : None ,
130
132
}
131
- . into_prim_f ( ) ] ;
133
+ . into_prim_float ( ) ] ;
132
134
133
135
/// Domain for `acosh`
134
136
const ACOSH : [ Self ; 1 ] =
135
137
[ Domain { start : Bound :: Included ( F :: ONE ) , end : Bound :: Unbounded , check_points : None }
136
- . into_prim_f ( ) ] ;
138
+ . into_prim_float ( ) ] ;
137
139
138
140
/// Domain for `atanh`
139
141
const ATANH : [ Self ; 1 ] = [ Domain {
140
142
start : Bound :: Excluded ( F :: NEG_ONE ) ,
141
143
end : Bound :: Excluded ( F :: ONE ) ,
142
144
check_points : None ,
143
145
}
144
- . into_prim_f ( ) ] ;
146
+ . into_prim_float ( ) ] ;
145
147
146
148
/// Domain for `sin`, `cos`, and `tan`
147
149
const TRIG : [ Self ; 1 ] = [ Domain {
148
- // TODO
150
+ // Trig functions have special behavior at fractions of π.
149
151
check_points : Some ( || Box :: new ( [ -F :: PI , -F :: FRAC_PI_2 , F :: FRAC_PI_2 , F :: PI ] . into_iter ( ) ) ) ,
150
152
..Domain :: UNBOUNDED
151
153
}
152
- . into_prim_f ( ) ] ;
154
+ . into_prim_float ( ) ] ;
153
155
154
156
/// Domain for `log` in various bases
155
157
const LOG : [ Self ; 1 ] = Self :: STRICTLY_POSITIVE ;
156
158
157
159
/// Domain for `log1p` i.e. `log(1 + x)`
158
160
const LOG1P : [ Self ; 1 ] =
159
161
[ Domain { start : Bound :: Excluded ( F :: NEG_ONE ) , end : Bound :: Unbounded , check_points : None }
160
- . into_prim_f ( ) ] ;
162
+ . into_prim_float ( ) ] ;
161
163
162
164
/// Domain for `sqrt`
163
165
const SQRT : [ Self ; 1 ] = Self :: POSITIVE ;
@@ -177,7 +179,7 @@ impl<F: Float, I: Int> EitherPrim<Domain<F>, Domain<I>> {
177
179
// Whether or not gamma is defined for negative numbers is implementation dependent
178
180
..Domain :: UNBOUNDED
179
181
}
180
- . into_prim_f ( ) ] ;
182
+ . into_prim_float ( ) ] ;
181
183
182
184
/// Domain for `loggamma`
183
185
const LGAMMA : [ Self ; 1 ] = Self :: STRICTLY_POSITIVE ;
@@ -186,7 +188,7 @@ impl<F: Float, I: Int> EitherPrim<Domain<F>, Domain<I>> {
186
188
// FIXME: the domain should provide some sort of "reasonable range" so we don't actually test
187
189
// the entire system unbounded.
188
190
const BESSEL_N : [ Self ; 2 ] =
189
- [ Domain :: UNBOUNDED_INT . into_prim_i ( ) , Domain :: UNBOUNDED . into_prim_f ( ) ] ;
191
+ [ Domain :: UNBOUNDED_INT . into_prim_int ( ) , Domain :: UNBOUNDED . into_prim_float ( ) ] ;
190
192
}
191
193
192
194
/// Get the domain for a given function.
0 commit comments