@@ -1182,13 +1182,15 @@ export namespace NativeMath {
11821182 export function pow ( x : f64 , y : f64 ) : f64 { // see: musl/src/math/pow.c and SUN COPYRIGHT NOTICE above
11831183 // TODO: remove this fast pathes after introduced own mid-end IR with "stdlib call simplify" transforms
11841184 if ( builtin_abs < f64 > ( y ) <= 2 ) {
1185- if ( y == 2.0 ) return x * x ;
1186- if ( y == 0.5 ) return select < f64 > ( Infinity , builtin_sqrt < f64 > ( x ) , builtin_abs < f64 > ( x ) == Infinity ) ;
1187- if ( y == - 1.0 ) return 1 / x ;
1188- if ( y == - 0.5 ) {
1189- if ( x == 0.0 ) return Infinity ;
1190- return select < f64 > ( 0 , 1 / builtin_sqrt < f64 > ( x ) , builtin_abs < f64 > ( x ) == Infinity ) ;
1185+ if ( y == 2.0 ) return x * x ;
1186+ if ( y == 0.5 ) {
1187+ return select < f64 > (
1188+ builtin_abs < f64 > ( builtin_sqrt < f64 > ( x ) ) ,
1189+ Infinity ,
1190+ x != - Infinity
1191+ ) ;
11911192 }
1193+ if ( y == - 1.0 ) return 1 / x ;
11921194 if ( y == 1.0 ) return x ;
11931195 if ( y == 0.0 ) return 1.0 ;
11941196 }
@@ -2578,13 +2580,15 @@ export namespace NativeMathf {
25782580 export function pow ( x : f32 , y : f32 ) : f32 { // see: musl/src/math/powf.c and SUN COPYRIGHT NOTICE above
25792581 // TODO: remove this fast pathes after introduced own mid-end IR with "stdlib call simplify" transforms
25802582 if ( builtin_abs < f32 > ( y ) <= 2 ) {
2581- if ( y == 2.0 ) return x * x ;
2582- if ( y == 0.5 ) return select < f32 > ( Infinity , builtin_sqrt < f32 > ( x ) , builtin_abs < f32 > ( x ) == Infinity ) ;
2583- if ( y == - 1.0 ) return 1 / x ;
2584- if ( y == - 0.5 ) {
2585- if ( x == 0.0 ) return Infinity ;
2586- return select < f32 > ( 0 , 1 / builtin_sqrt < f32 > ( x ) , builtin_abs < f32 > ( x ) == Infinity ) ;
2583+ if ( y == 2.0 ) return x * x ;
2584+ if ( y == 0.5 ) {
2585+ return select < f32 > (
2586+ builtin_abs < f32 > ( builtin_sqrt < f32 > ( x ) ) ,
2587+ Infinity ,
2588+ x != - Infinity
2589+ ) ;
25872590 }
2591+ if ( y == - 1.0 ) return 1 / x ;
25882592 if ( y == 1.0 ) return x ;
25892593 if ( y == 0.0 ) return 1.0 ;
25902594 }
0 commit comments