/* S(x) rational function for positive x */ fn s(x: f64) -> f64 { letmut num: f64 = 0.0; letmut den: f64 = 0.0;
/* to avoid overflow handle large x differently */ if x < 8.0 { for i in (0..=N).rev() {
num = num * x + i!(SNUM, i);
den = den * x + i!(SDEN, i);
}
} else { for i in0..=N {
num = num / x + i!(SNUM, i);
den = den / x + i!(SDEN, i);
}
} return num / den;
}
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] pubfn tgamma(mut x: f64) -> f64 { let u: u64 = x.to_bits(); let absx: f64; letmut y: f64; letmut dy: f64; letmut z: f64; letmut r: f64; let ix: u32 = ((u >> 32) as u32) & 0x7fffffff; let sign: bool = (u >> 63) != 0;
/* special cases */ if ix >= 0x7ff00000 { /* tgamma(nan)=nan, tgamma(inf)=inf, tgamma(-inf)=nan with invalid */ return x + core::f64::INFINITY;
} if ix < ((0x3ff - 54) << 20) { /* |x| < 2^-54: tgamma(x) ~ 1/x, +-0 raises div-by-zero */ return1.0 / x;
}
/* integer arguments */ /* raise inexact when non-integer */ if x == floor(x) { if sign { return0.0 / 0.0;
} if x <= FACT.len() as f64 { return i!(FACT, (x as usize) - 1);
}
}
/* x >= 172: tgamma(x)=inf with overflow */ /* x =< -184: tgamma(x)=+-0 with underflow */ if ix >= 0x40670000 { /* |x| >= 184 */ if sign { let x1p_126 = f64::from_bits(0x3810000000000000); // 0x1p-126 == 2^-126
force_eval!((x1p_126 / x) as f32); if floor(x) * 0.5 == floor(x * 0.5) { return0.0;
} else { return -0.0;
}
} let x1p1023 = f64::from_bits(0x7fe0000000000000); // 0x1p1023 == 2^1023
x *= x1p1023; return x;
}
absx = if sign { -x } else { x };
/* handle the error of x + g - 0.5 */
y = absx + GMHALF; if absx > GMHALF {
dy = y - absx;
dy -= GMHALF;
} else {
dy = y - GMHALF;
dy -= absx;
}
z = absx - 0.5;
r = s(absx) * exp(-y); if x < 0.0 { /* reflection formula for negative x */ /* sinpi(absx) is not 0, integers are already handled */
r = -PI / (sinpi(absx) * absx * r);
dy = -dy;
z = -z;
}
r += dy * (GMHALF + 0.5) * r / y;
z = pow(y, 0.5 * z);
y = r * z * z; return y;
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.11 Sekunden
(vorverarbeitet am 2026-06-18)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.