Filter out special cases for log in bases {e,2,10}.
If x is finite and positive, returns null. Returns the appropriate NaN or inf otherwise.
pub fn specialCases(x: f128) ?f128
pub fn specialCases(x: f128) ?f128 {
if (!math.isFinite(x)) {
if (math.isNan(x)) {
if (math.isSignalNan(x)) math.raiseInvalid();
return math.nan(f128);
}
if (math.isPositiveInf(x)) return x;
}
if (x <= 0.0) {
if (x >= 0.0) {
math.raiseDivByZero();
return -math.inf(f128);
}
math.raiseInvalid();
return math.nan(f128);
}
return null;
}