\[\left(x \cdot \log y + z \cdot \log \left(1 - y\right)\right) - t
\]
↓
\[\mathsf{fma}\left(\mathsf{log1p}\left(-y\right), z, \mathsf{fma}\left(x, \log y, -t\right)\right)
\]
(FPCore (x y z t)
:precision binary64
(- (+ (* x (log y)) (* z (log (- 1.0 y)))) t))
↓
(FPCore (x y z t)
:precision binary64
(fma (log1p (- y)) z (fma x (log y) (- t))))
double code(double x, double y, double z, double t) {
return ((x * log(y)) + (z * log((1.0 - y)))) - t;
}
↓
double code(double x, double y, double z, double t) {
return fma(log1p(-y), z, fma(x, log(y), -t));
}
function code(x, y, z, t)
return Float64(Float64(Float64(x * log(y)) + Float64(z * log(Float64(1.0 - y)))) - t)
end
↓
function code(x, y, z, t)
return fma(log1p(Float64(-y)), z, fma(x, log(y), Float64(-t)))
end
code[x_, y_, z_, t_] := N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(z * N[Log[N[(1.0 - y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
↓
code[x_, y_, z_, t_] := N[(N[Log[1 + (-y)], $MachinePrecision] * z + N[(x * N[Log[y], $MachinePrecision] + (-t)), $MachinePrecision]), $MachinePrecision]
\left(x \cdot \log y + z \cdot \log \left(1 - y\right)\right) - t
↓
\mathsf{fma}\left(\mathsf{log1p}\left(-y\right), z, \mathsf{fma}\left(x, \log y, -t\right)\right)