@@ -207,22 +207,6 @@ impl<T: AsRef<Real>> Sub<T> for &Real {
207207
208208 fn sub ( self , other : T ) -> Self :: Output {
209209 let other = other. as_ref ( ) ;
210- if self . class == Pi
211- && self . rational . is_one ( )
212- && other. class == One
213- && other. rational == * rationals:: THREE
214- {
215- crate :: trace_dispatch!( "real" , "sub" , "cached-pi-minus-three" ) ;
216- return constants:: pi_minus_three ( ) ;
217- }
218- if self . class == One
219- && self . rational == * rationals:: THREE
220- && other. class == Pi
221- && other. rational . is_one ( )
222- {
223- crate :: trace_dispatch!( "real" , "sub" , "cached-three-minus-pi" ) ;
224- return -constants:: pi_minus_three ( ) ;
225- }
226210 if self . class == other. class {
227211 // Same symbolic basis subtraction mirrors addition: update the scale only.
228212 let rational = & self . rational - & other. rational ;
@@ -240,6 +224,22 @@ impl<T: AsRef<Real>> Sub<T> for &Real {
240224 primitive_approx_cache : Cell :: new ( PrimitiveApproxCache :: Empty ) ,
241225 } ;
242226 }
227+ if self . class == Pi
228+ && self . rational . is_one ( )
229+ && other. class == One
230+ && other. rational == * rationals:: THREE
231+ {
232+ crate :: trace_dispatch!( "real" , "sub" , "cached-pi-minus-three" ) ;
233+ return constants:: pi_minus_three ( ) ;
234+ }
235+ if self . class == One
236+ && self . rational == * rationals:: THREE
237+ && other. class == Pi
238+ && other. rational . is_one ( )
239+ {
240+ crate :: trace_dispatch!( "real" , "sub" , "cached-three-minus-pi" ) ;
241+ return -constants:: pi_minus_three ( ) ;
242+ }
243243 if other. has_zero_scale ( ) {
244244 return self . clone ( ) ;
245245 }
@@ -396,4 +396,3 @@ impl Real {
396396 }
397397 }
398398}
399-
0 commit comments