X7ROOT File Manager
Current Path:
/opt/golang/1.22.0/src/math
opt
/
golang
/
1.22.0
/
src
/
math
/
📁
..
📄
abs.go
(366 B)
📄
acos_s390x.s
(3.73 KB)
📄
acosh.go
(1.71 KB)
📄
acosh_s390x.s
(4.32 KB)
📄
all_test.go
(86.77 KB)
📄
arith_s390x.go
(3.73 KB)
📄
arith_s390x_test.go
(10.78 KB)
📄
asin.go
(1.09 KB)
📄
asin_s390x.s
(4.16 KB)
📄
asinh.go
(1.92 KB)
📄
asinh_s390x.s
(5.74 KB)
📄
atan.go
(3.03 KB)
📄
atan2.go
(1.52 KB)
📄
atan2_s390x.s
(6.93 KB)
📄
atan_s390x.s
(3.69 KB)
📄
atanh.go
(1.99 KB)
📄
atanh_s390x.s
(5.06 KB)
📁
big
📁
bits
📄
bits.go
(1.87 KB)
📄
cbrt.go
(2.31 KB)
📄
cbrt_s390x.s
(4.89 KB)
📁
cmplx
📄
const.go
(2.76 KB)
📄
const_test.go
(1.29 KB)
📄
copysign.go
(396 B)
📄
cosh_s390x.s
(5.59 KB)
📄
dim.go
(1.87 KB)
📄
dim_amd64.s
(1.92 KB)
📄
dim_arm64.s
(963 B)
📄
dim_asm.go
(344 B)
📄
dim_noasm.go
(410 B)
📄
dim_riscv64.s
(1.16 KB)
📄
dim_s390x.s
(1.97 KB)
📄
erf.go
(11.51 KB)
📄
erf_s390x.s
(8.5 KB)
📄
erfc_s390x.s
(14.4 KB)
📄
erfinv.go
(3.37 KB)
📄
example_test.go
(3.75 KB)
📄
exp.go
(5.38 KB)
📄
exp2_asm.go
(252 B)
📄
exp2_noasm.go
(284 B)
📄
exp_amd64.go
(261 B)
📄
exp_amd64.s
(4.24 KB)
📄
exp_arm64.s
(5.36 KB)
📄
exp_asm.go
(268 B)
📄
exp_noasm.go
(302 B)
📄
exp_s390x.s
(4.65 KB)
📄
expm1.go
(7.91 KB)
📄
expm1_s390x.s
(5.29 KB)
📄
export_s390x_test.go
(732 B)
📄
export_test.go
(357 B)
📄
floor.go
(3.29 KB)
📄
floor_386.s
(1.47 KB)
📄
floor_amd64.s
(2 KB)
📄
floor_arm64.s
(573 B)
📄
floor_asm.go
(431 B)
📄
floor_noasm.go
(531 B)
📄
floor_ppc64x.s
(499 B)
📄
floor_s390x.s
(579 B)
📄
floor_wasm.s
(459 B)
📄
fma.go
(4.61 KB)
📄
frexp.go
(929 B)
📄
gamma.go
(5.53 KB)
📄
huge_test.go
(2.91 KB)
📄
hypot.go
(850 B)
📄
hypot_386.s
(1.81 KB)
📄
hypot_amd64.s
(1.05 KB)
📄
hypot_asm.go
(264 B)
📄
hypot_noasm.go
(297 B)
📄
j0.go
(13.6 KB)
📄
j1.go
(13.3 KB)
📄
jn.go
(7.18 KB)
📄
ldexp.go
(1.05 KB)
📄
lgamma.go
(11.03 KB)
📄
log.go
(3.86 KB)
📄
log10.go
(873 B)
📄
log10_s390x.s
(4.73 KB)
📄
log1p.go
(6.34 KB)
📄
log1p_s390x.s
(5.15 KB)
📄
log_amd64.s
(3.66 KB)
📄
log_asm.go
(259 B)
📄
log_s390x.s
(4.31 KB)
📄
log_stub.go
(292 B)
📄
logb.go
(1021 B)
📄
mod.go
(903 B)
📄
modf.go
(913 B)
📄
modf_arm64.s
(447 B)
📄
modf_asm.go
(292 B)
📄
modf_noasm.go
(326 B)
📄
modf_ppc64x.s
(416 B)
📄
nextafter.go
(1.21 KB)
📄
pow.go
(3.65 KB)
📄
pow10.go
(1.24 KB)
📄
pow_s390x.s
(16.27 KB)
📁
rand
📄
remainder.go
(2.04 KB)
📄
signbit.go
(302 B)
📄
sin.go
(6.35 KB)
📄
sin_s390x.s
(8.57 KB)
📄
sincos.go
(1.76 KB)
📄
sinh.go
(1.69 KB)
📄
sinh_s390x.s
(5.98 KB)
📄
sqrt.go
(4.75 KB)
📄
stubs.go
(2.57 KB)
📄
stubs_s390x.s
(12.38 KB)
📄
tan.go
(3.68 KB)
📄
tan_s390x.s
(2.72 KB)
📄
tanh.go
(2.66 KB)
📄
tanh_s390x.s
(4.57 KB)
📄
trig_reduce.go
(3.34 KB)
📄
unsafe.go
(1.27 KB)
Editing: fma.go
// Copyright 2019 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package math import "math/bits" func zero(x uint64) uint64 { if x == 0 { return 1 } return 0 // branchless: // return ((x>>1 | x&1) - 1) >> 63 } func nonzero(x uint64) uint64 { if x != 0 { return 1 } return 0 // branchless: // return 1 - ((x>>1|x&1)-1)>>63 } func shl(u1, u2 uint64, n uint) (r1, r2 uint64) { r1 = u1<<n | u2>>(64-n) | u2<<(n-64) r2 = u2 << n return } func shr(u1, u2 uint64, n uint) (r1, r2 uint64) { r2 = u2>>n | u1<<(64-n) | u1>>(n-64) r1 = u1 >> n return } // shrcompress compresses the bottom n+1 bits of the two-word // value into a single bit. the result is equal to the value // shifted to the right by n, except the result's 0th bit is // set to the bitwise OR of the bottom n+1 bits. func shrcompress(u1, u2 uint64, n uint) (r1, r2 uint64) { // TODO: Performance here is really sensitive to the // order/placement of these branches. n == 0 is common // enough to be in the fast path. Perhaps more measurement // needs to be done to find the optimal order/placement? switch { case n == 0: return u1, u2 case n == 64: return 0, u1 | nonzero(u2) case n >= 128: return 0, nonzero(u1 | u2) case n < 64: r1, r2 = shr(u1, u2, n) r2 |= nonzero(u2 & (1<<n - 1)) case n < 128: r1, r2 = shr(u1, u2, n) r2 |= nonzero(u1&(1<<(n-64)-1) | u2) } return } func lz(u1, u2 uint64) (l int32) { l = int32(bits.LeadingZeros64(u1)) if l == 64 { l += int32(bits.LeadingZeros64(u2)) } return l } // split splits b into sign, biased exponent, and mantissa. // It adds the implicit 1 bit to the mantissa for normal values, // and normalizes subnormal values. func split(b uint64) (sign uint32, exp int32, mantissa uint64) { sign = uint32(b >> 63) exp = int32(b>>52) & mask mantissa = b & fracMask if exp == 0 { // Normalize value if subnormal. shift := uint(bits.LeadingZeros64(mantissa) - 11) mantissa <<= shift exp = 1 - int32(shift) } else { // Add implicit 1 bit mantissa |= 1 << 52 } return } // FMA returns x * y + z, computed with only one rounding. // (That is, FMA returns the fused multiply-add of x, y, and z.) func FMA(x, y, z float64) float64 { bx, by, bz := Float64bits(x), Float64bits(y), Float64bits(z) // Inf or NaN or zero involved. At most one rounding will occur. if x == 0.0 || y == 0.0 || z == 0.0 || bx&uvinf == uvinf || by&uvinf == uvinf { return x*y + z } // Handle non-finite z separately. Evaluating x*y+z where // x and y are finite, but z is infinite, should always result in z. if bz&uvinf == uvinf { return z } // Inputs are (sub)normal. // Split x, y, z into sign, exponent, mantissa. xs, xe, xm := split(bx) ys, ye, ym := split(by) zs, ze, zm := split(bz) // Compute product p = x*y as sign, exponent, two-word mantissa. // Start with exponent. "is normal" bit isn't subtracted yet. pe := xe + ye - bias + 1 // pm1:pm2 is the double-word mantissa for the product p. // Shift left to leave top bit in product. Effectively // shifts the 106-bit product to the left by 21. pm1, pm2 := bits.Mul64(xm<<10, ym<<11) zm1, zm2 := zm<<10, uint64(0) ps := xs ^ ys // product sign // normalize to 62nd bit is62zero := uint((^pm1 >> 62) & 1) pm1, pm2 = shl(pm1, pm2, is62zero) pe -= int32(is62zero) // Swap addition operands so |p| >= |z| if pe < ze || pe == ze && pm1 < zm1 { ps, pe, pm1, pm2, zs, ze, zm1, zm2 = zs, ze, zm1, zm2, ps, pe, pm1, pm2 } // Special case: if p == -z the result is always +0 since neither operand is zero. if ps != zs && pe == ze && pm1 == zm1 && pm2 == zm2 { return 0 } // Align significands zm1, zm2 = shrcompress(zm1, zm2, uint(pe-ze)) // Compute resulting significands, normalizing if necessary. var m, c uint64 if ps == zs { // Adding (pm1:pm2) + (zm1:zm2) pm2, c = bits.Add64(pm2, zm2, 0) pm1, _ = bits.Add64(pm1, zm1, c) pe -= int32(^pm1 >> 63) pm1, m = shrcompress(pm1, pm2, uint(64+pm1>>63)) } else { // Subtracting (pm1:pm2) - (zm1:zm2) // TODO: should we special-case cancellation? pm2, c = bits.Sub64(pm2, zm2, 0) pm1, _ = bits.Sub64(pm1, zm1, c) nz := lz(pm1, pm2) pe -= nz m, pm2 = shl(pm1, pm2, uint(nz-1)) m |= nonzero(pm2) } // Round and break ties to even if pe > 1022+bias || pe == 1022+bias && (m+1<<9)>>63 == 1 { // rounded value overflows exponent range return Float64frombits(uint64(ps)<<63 | uvinf) } if pe < 0 { n := uint(-pe) m = m>>n | nonzero(m&(1<<n-1)) pe = 0 } m = ((m + 1<<9) >> 10) & ^zero((m&(1<<10-1))^1<<9) pe &= -int32(nonzero(m)) return Float64frombits(uint64(ps)<<63 + uint64(pe)<<52 + m) }
Upload File
Create Folder