@@ -1441,20 +1441,20 @@ export namespace NativeMath {
14411441 return reinterpret < f64 > ( r ) - 1 ;
14421442 }
14431443
1444- // @ts -ignore: decorator
1445- @inline
14461444 export function round ( x : f64 ) : f64 {
1447- let roundUp = builtin_ceil < f64 > ( x ) ;
1448- return select < f64 > ( roundUp , roundUp - 1.0 , roundUp - 0.5 <= x ) ;
1445+ if ( ASC_SHRINK_LEVEL > 0 ) {
1446+ return builtin_ceil < f64 > ( x ) - f64 ( builtin_ceil < f64 > ( x ) - 0.5 > x ) ;
1447+ } else {
1448+ let roundUp = builtin_ceil < f64 > ( x ) ;
1449+ return select < f64 > ( roundUp , roundUp - 1.0 , roundUp - 0.5 <= x ) ;
1450+ }
14491451 }
14501452
1451- // @ts -ignore: decorator
1452- @inline
14531453 export function sign ( x : f64 ) : f64 {
14541454 if ( ASC_SHRINK_LEVEL > 0 ) {
1455- return builtin_abs ( x ) > 0 ? builtin_copysign < f64 > ( 1 , x ) : x ;
1455+ return select < f64 > ( builtin_copysign < f64 > ( 1 , x ) , x , builtin_abs ( x ) > 0 ) ;
14561456 } else {
1457- return x > 0 ? 1 : x < 0 ? - 1 : x ;
1457+ return select < f64 > ( 1 , select < f64 > ( - 1 , x , x < 0 ) , x > 0 ) ;
14581458 }
14591459 }
14601460
@@ -2739,20 +2739,20 @@ export namespace NativeMathf {
27392739 return reinterpret < f32 > ( ( r >> 9 ) | ( 127 << 23 ) ) - 1.0 ;
27402740 }
27412741
2742- // @ts -ignore: decorator
2743- @inline
27442742 export function round ( x : f32 ) : f32 {
2745- let roundUp = builtin_ceil < f32 > ( x ) ;
2746- return select < f32 > ( roundUp , roundUp - 1.0 , roundUp - 0.5 <= x ) ;
2743+ if ( ASC_SHRINK_LEVEL > 0 ) {
2744+ return builtin_ceil < f32 > ( x ) - f32 ( builtin_ceil < f32 > ( x ) - 0.5 > x ) ;
2745+ } else {
2746+ let roundUp = builtin_ceil < f32 > ( x ) ;
2747+ return select < f32 > ( roundUp , roundUp - 1.0 , roundUp - 0.5 <= x ) ;
2748+ }
27472749 }
27482750
2749- // @ts -ignore: decorator
2750- @inline
27512751 export function sign ( x : f32 ) : f32 {
27522752 if ( ASC_SHRINK_LEVEL > 0 ) {
2753- return builtin_abs ( x ) > 0 ? builtin_copysign < f32 > ( 1 , x ) : x ;
2753+ return select < f32 > ( builtin_copysign < f32 > ( 1 , x ) , x , builtin_abs ( x ) > 0 ) ;
27542754 } else {
2755- return x > 0 ? 1 : x < 0 ? - 1 : x ;
2755+ return select < f32 > ( 1 , select < f32 > ( - 1 , x , x < 0 ) , x > 0 ) ;
27562756 }
27572757 }
27582758
0 commit comments