math: rename small to small_ to prevent C errors (workaround unescaped C labels) (#12796)
parent
24bc2ae406
commit
9e68a03f94
|
@ -164,7 +164,7 @@ const (
|
||||||
pub fn erf(a f64) f64 {
|
pub fn erf(a f64) f64 {
|
||||||
mut x := a
|
mut x := a
|
||||||
very_tiny := 2.848094538889218e-306 // 0x0080000000000000
|
very_tiny := 2.848094538889218e-306 // 0x0080000000000000
|
||||||
small := 1.0 / f64(u64(1) << 28) // 2**-28
|
small_ := 1.0 / f64(u64(1) << 28) // 2**-28
|
||||||
if is_nan(x) {
|
if is_nan(x) {
|
||||||
return nan()
|
return nan()
|
||||||
}
|
}
|
||||||
|
@ -181,7 +181,7 @@ pub fn erf(a f64) f64 {
|
||||||
}
|
}
|
||||||
if x < 0.84375 { // |x| < 0.84375
|
if x < 0.84375 { // |x| < 0.84375
|
||||||
mut temp := 0.0
|
mut temp := 0.0
|
||||||
if x < small { // |x| < 2**-28
|
if x < small_ { // |x| < 2**-28
|
||||||
if x < very_tiny {
|
if x < very_tiny {
|
||||||
temp = 0.125 * (8.0 * x + math.efx8 * x) // avoid underflow
|
temp = 0.125 * (8.0 * x + math.efx8 * x) // avoid underflow
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -93,7 +93,7 @@ pub fn gamma(a f64) f64 {
|
||||||
for x < 0 {
|
for x < 0 {
|
||||||
if x > -1e-09 {
|
if x > -1e-09 {
|
||||||
unsafe {
|
unsafe {
|
||||||
goto small
|
goto small_
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
z = z / x
|
z = z / x
|
||||||
|
@ -102,7 +102,7 @@ pub fn gamma(a f64) f64 {
|
||||||
for x < 2 {
|
for x < 2 {
|
||||||
if x < 1e-09 {
|
if x < 1e-09 {
|
||||||
unsafe {
|
unsafe {
|
||||||
goto small
|
goto small_
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
z = z / x
|
z = z / x
|
||||||
|
@ -119,7 +119,7 @@ pub fn gamma(a f64) f64 {
|
||||||
if true {
|
if true {
|
||||||
return z * p / q
|
return z * p / q
|
||||||
}
|
}
|
||||||
small:
|
small_:
|
||||||
if x == 0 {
|
if x == 0 {
|
||||||
return inf(1)
|
return inf(1)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue