@@ -1441,20 +1441,20 @@ export namespace NativeMath {
1441
1441
return reinterpret < f64 > ( r ) - 1 ;
1442
1442
}
1443
1443
1444
- // @ts -ignore: decorator
1445
- @inline
1446
1444
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
+ }
1449
1451
}
1450
1452
1451
- // @ts -ignore: decorator
1452
- @inline
1453
1453
export function sign ( x : f64 ) : f64 {
1454
1454
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 ) ;
1456
1456
} else {
1457
- return x > 0 ? 1 : x < 0 ? - 1 : x ;
1457
+ return select < f64 > ( 1 , select < f64 > ( - 1 , x , x < 0 ) , x > 0 ) ;
1458
1458
}
1459
1459
}
1460
1460
@@ -2739,20 +2739,20 @@ export namespace NativeMathf {
2739
2739
return reinterpret < f32 > ( ( r >> 9 ) | ( 127 << 23 ) ) - 1.0 ;
2740
2740
}
2741
2741
2742
- // @ts -ignore: decorator
2743
- @inline
2744
2742
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
+ }
2747
2749
}
2748
2750
2749
- // @ts -ignore: decorator
2750
- @inline
2751
2751
export function sign ( x : f32 ) : f32 {
2752
2752
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 ) ;
2754
2754
} else {
2755
- return x > 0 ? 1 : x < 0 ? - 1 : x ;
2755
+ return select < f32 > ( 1 , select < f32 > ( - 1 , x , x < 0 ) , x > 0 ) ;
2756
2756
}
2757
2757
}
2758
2758
0 commit comments