File tree Expand file tree Collapse file tree 8 files changed +3882
-3023
lines changed Expand file tree Collapse file tree 8 files changed +3882
-3023
lines changed Original file line number Diff line number Diff line change @@ -422,8 +422,10 @@ export namespace NativeMath {
422
422
} else if ( hx > 0x3E300000 ) {
423
423
hi = x ;
424
424
} else return 1.0 + x ;
425
- var xx = x * x ;
426
- var c = x - xx * ( P1 + xx * ( P2 + xx * ( P3 + xx * ( P4 + xx * P5 ) ) ) ) ;
425
+ var xs = x * x ;
426
+ // var c = x - xp2 * (P1 + xp2 * (P2 + xp2 * (P3 + xp2 * (P4 + xp2 * P5))));
427
+ var xq = xs * xs ;
428
+ var c = x - ( xs * P1 + xq * ( ( P2 + xs * P3 ) + xq * ( P4 + xs * P5 ) ) ) ;
427
429
var y = 1.0 + ( x * c / ( 2 - c ) - lo + hi ) ;
428
430
if ( k == 0 ) return y ;
429
431
return scalbn ( y , k ) ;
@@ -464,7 +466,9 @@ export namespace NativeMath {
464
466
} else if ( hx < 0x3C900000 ) return x ;
465
467
var hfx = 0.5 * x ;
466
468
var hxs = x * hfx ;
467
- var r1 = 1.0 + hxs * ( Q1 + hxs * ( Q2 + hxs * ( Q3 + hxs * ( Q4 + hxs * Q5 ) ) ) ) ;
469
+ // var r1 = 1.0 + hxs * (Q1 + hxs * (Q2 + hxs * (Q3 + hxs * (Q4 + hxs * Q5))));
470
+ var hxq = hxs * hxs ;
471
+ var r1 = ( 1.0 + hxs * Q1 ) + hxq * ( ( Q2 + hxs * Q3 ) + hxq * ( Q4 + hxs * Q5 ) ) ;
468
472
t = 3.0 - r1 * hfx ;
469
473
var e = hxs * ( ( r1 - t ) / ( 6.0 - x * t ) ) ;
470
474
if ( k == 0 ) return x - ( x * e - hxs ) ;
Original file line number Diff line number Diff line change 3457
3457
if
3458
3458
i32.const 0
3459
3459
i32.const 552
3460
- i32.const 955
3460
+ i32.const 959
3461
3461
i32.const 4
3462
3462
call $~lib/env/abort
3463
3463
unreachable
5173
5173
if
5174
5174
i32.const 0
5175
5175
i32.const 552
5176
- i32.const 964
5176
+ i32.const 968
5177
5177
i32.const 24
5178
5178
call $~lib/env/abort
5179
5179
unreachable
Original file line number Diff line number Diff line change 4512
4512
if
4513
4513
i32.const 0
4514
4514
i32.const 552
4515
- i32.const 955
4515
+ i32.const 959
4516
4516
i32.const 4
4517
4517
call $~lib/env/abort
4518
4518
unreachable
7609
7609
if
7610
7610
i32.const 0
7611
7611
i32.const 552
7612
- i32.const 964
7612
+ i32.const 968
7613
7613
i32.const 24
7614
7614
call $~lib/env/abort
7615
7615
unreachable
Original file line number Diff line number Diff line change 1695
1695
return
1696
1696
end
1697
1697
end
1698
- f64.const 1
1699
1698
get_local $0
1700
1699
f64.const 0.5
1701
1700
get_local $0
1702
1701
f64.mul
1703
1702
tee_local $8
1704
1703
f64.mul
1705
1704
tee_local $2
1706
- f64.const -0.03333333333333313
1707
1705
get_local $2
1706
+ f64.mul
1707
+ set_local $1
1708
+ f64.const 3
1709
+ f64.const 1
1710
+ get_local $2
1711
+ f64.const -0.03333333333333313
1712
+ f64.mul
1713
+ f64.add
1714
+ get_local $1
1708
1715
f64.const 1.5873015872548146e-03
1709
1716
get_local $2
1710
1717
f64.const -7.93650757867488e-05
1711
- get_local $2
1718
+ f64.mul
1719
+ f64.add
1720
+ get_local $1
1712
1721
f64.const 4.008217827329362e-06
1713
1722
get_local $2
1714
1723
f64.const -2.0109921818362437e-07
1718
1727
f64.add
1719
1728
f64.mul
1720
1729
f64.add
1721
- f64.mul
1722
- f64.add
1723
- f64.mul
1724
- f64.add
1725
1730
tee_local $9
1731
+ get_local $8
1732
+ f64.mul
1733
+ f64.sub
1726
1734
set_local $1
1727
1735
get_local $2
1728
1736
get_local $9
1729
- f64.const 3
1730
1737
get_local $1
1731
- get_local $8
1732
- f64.mul
1733
- f64.sub
1734
- tee_local $1
1735
1738
f64.sub
1736
1739
f64.const 6
1737
1740
get_local $0
1954
1957
)
1955
1958
(func $~lib/math/NativeMath.exp (; 25 ;) (type $FF ) (param $0 f64 ) (result f64 )
1956
1959
(local $1 i32 )
1957
- (local $2 i32 )
1958
- (local $3 f64 )
1959
- (local $4 i32 )
1960
+ (local $2 f64 )
1961
+ (local $3 i32 )
1962
+ (local $4 f64 )
1960
1963
(local $5 f64 )
1964
+ (local $6 i32 )
1965
+ (local $7 f64 )
1961
1966
get_local $0
1962
1967
i64.reinterpret /f64
1963
1968
i64.const 32
1966
1971
tee_local $1
1967
1972
i32.const 31
1968
1973
i32.shr_u
1969
- set_local $4
1974
+ set_local $6
1970
1975
get_local $1
1971
1976
i32.const 2147483647
1972
1977
i32.and
2017
2022
i32.trunc_s /f64
2018
2023
else
2019
2024
i32.const 1
2020
- get_local $4
2025
+ get_local $6
2021
2026
i32.const 1
2022
2027
i32.shl
2023
2028
i32.sub
2024
2029
end
2025
- tee_local $2
2030
+ tee_local $3
2026
2031
f64.convert_s /i32
2027
2032
tee_local $0
2028
2033
f64.const 0.6931471803691238
2029
2034
f64.mul
2030
2035
f64.sub
2031
- tee_local $3
2036
+ tee_local $4
2032
2037
get_local $0
2033
2038
f64.const 1.9082149292705877e-10
2034
2039
f64.mul
2035
- tee_local $5
2040
+ tee_local $7
2036
2041
f64.sub
2037
2042
set_local $0
2038
2043
else
2046
2051
return
2047
2052
end
2048
2053
get_local $0
2049
- set_local $3
2054
+ set_local $4
2050
2055
end
2051
- f64.const 1
2052
2056
get_local $0
2053
2057
get_local $0
2058
+ f64.mul
2059
+ tee_local $2
2060
+ get_local $2
2061
+ f64.mul
2062
+ set_local $5
2063
+ f64.const 1
2054
2064
get_local $0
2055
2065
get_local $0
2056
- f64.mul
2057
- tee_local $0
2066
+ get_local $2
2058
2067
f64.const 0.16666666666666602
2059
- get_local $0
2068
+ f64.mul
2069
+ get_local $5
2060
2070
f64.const -2.7777777777015593e-03
2061
- get_local $0
2071
+ get_local $2
2062
2072
f64.const 6.613756321437934e-05
2063
- get_local $0
2064
- f64.const -1.6533902205465252e-06
2065
- get_local $0
2066
- f64.const 4.1381367970572385e-08
2067
2073
f64.mul
2068
2074
f64.add
2075
+ get_local $5
2076
+ f64.const -1.6533902205465252e-06
2077
+ get_local $2
2078
+ f64.const 4.1381367970572385e-08
2069
2079
f64.mul
2070
2080
f64.add
2071
2081
f64.mul
2072
2082
f64.add
2073
2083
f64.mul
2074
2084
f64.add
2075
- f64.mul
2076
2085
f64.sub
2077
2086
tee_local $0
2078
2087
f64.mul
2079
2088
f64.const 2
2080
2089
get_local $0
2081
2090
f64.sub
2082
2091
f64.div
2083
- get_local $5
2092
+ get_local $7
2084
2093
f64.sub
2085
- get_local $3
2094
+ get_local $4
2086
2095
f64.add
2087
2096
f64.add
2088
2097
set_local $0
2089
- get_local $2
2098
+ get_local $3
2090
2099
i32.eqz
2091
2100
if
2092
2101
get_local $0
2093
2102
return
2094
2103
end
2095
2104
get_local $0
2096
- get_local $2
2105
+ get_local $3
2097
2106
call $~lib/math/NativeMath.scalbn
2098
2107
)
2099
2108
(func $~lib/math/NativeMath.cosh (; 26 ;) (type $FF ) (param $0 f64 ) (result f64 )
You can’t perform that action at this time.
0 commit comments