
(FPCore (x y z) :precision binary64 (+ (* x 0.5) (* y (+ (- 1.0 z) (log z)))))
double code(double x, double y, double z) {
return (x * 0.5) + (y * ((1.0 - z) + log(z)));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x * 0.5d0) + (y * ((1.0d0 - z) + log(z)))
end function
public static double code(double x, double y, double z) {
return (x * 0.5) + (y * ((1.0 - z) + Math.log(z)));
}
def code(x, y, z): return (x * 0.5) + (y * ((1.0 - z) + math.log(z)))
function code(x, y, z) return Float64(Float64(x * 0.5) + Float64(y * Float64(Float64(1.0 - z) + log(z)))) end
function tmp = code(x, y, z) tmp = (x * 0.5) + (y * ((1.0 - z) + log(z))); end
code[x_, y_, z_] := N[(N[(x * 0.5), $MachinePrecision] + N[(y * N[(N[(1.0 - z), $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot 0.5 + y \cdot \left(\left(1 - z\right) + \log z\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (+ (* x 0.5) (* y (+ (- 1.0 z) (log z)))))
double code(double x, double y, double z) {
return (x * 0.5) + (y * ((1.0 - z) + log(z)));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x * 0.5d0) + (y * ((1.0d0 - z) + log(z)))
end function
public static double code(double x, double y, double z) {
return (x * 0.5) + (y * ((1.0 - z) + Math.log(z)));
}
def code(x, y, z): return (x * 0.5) + (y * ((1.0 - z) + math.log(z)))
function code(x, y, z) return Float64(Float64(x * 0.5) + Float64(y * Float64(Float64(1.0 - z) + log(z)))) end
function tmp = code(x, y, z) tmp = (x * 0.5) + (y * ((1.0 - z) + log(z))); end
code[x_, y_, z_] := N[(N[(x * 0.5), $MachinePrecision] + N[(y * N[(N[(1.0 - z), $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot 0.5 + y \cdot \left(\left(1 - z\right) + \log z\right)
\end{array}
(FPCore (x y z) :precision binary64 (fma y (- (log z) z) (fma 0.5 x y)))
double code(double x, double y, double z) {
return fma(y, (log(z) - z), fma(0.5, x, y));
}
function code(x, y, z) return fma(y, Float64(log(z) - z), fma(0.5, x, y)) end
code[x_, y_, z_] := N[(y * N[(N[Log[z], $MachinePrecision] - z), $MachinePrecision] + N[(0.5 * x + y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y, \log z - z, \mathsf{fma}\left(0.5, x, y\right)\right)
\end{array}
Initial program 99.9%
Taylor expanded in x around 0
sub-negN/A
associate-+r+N/A
mul-1-negN/A
distribute-lft-inN/A
*-rgt-identityN/A
associate-+r+N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
mul-1-negN/A
sub-negN/A
--lowering--.f64N/A
log-lowering-log.f64N/A
accelerator-lowering-fma.f6499.9
Simplified99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (fma y (log z) y)))
(if (<= z 2.4e-265)
t_0
(if (<= z 6e-104)
(* x (fma (/ y x) (- z) 0.5))
(if (<= z 3.2e-65) t_0 (fma y (- z) (* 0.5 x)))))))
double code(double x, double y, double z) {
double t_0 = fma(y, log(z), y);
double tmp;
if (z <= 2.4e-265) {
tmp = t_0;
} else if (z <= 6e-104) {
tmp = x * fma((y / x), -z, 0.5);
} else if (z <= 3.2e-65) {
tmp = t_0;
} else {
tmp = fma(y, -z, (0.5 * x));
}
return tmp;
}
function code(x, y, z) t_0 = fma(y, log(z), y) tmp = 0.0 if (z <= 2.4e-265) tmp = t_0; elseif (z <= 6e-104) tmp = Float64(x * fma(Float64(y / x), Float64(-z), 0.5)); elseif (z <= 3.2e-65) tmp = t_0; else tmp = fma(y, Float64(-z), Float64(0.5 * x)); end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(y * N[Log[z], $MachinePrecision] + y), $MachinePrecision]}, If[LessEqual[z, 2.4e-265], t$95$0, If[LessEqual[z, 6e-104], N[(x * N[(N[(y / x), $MachinePrecision] * (-z) + 0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.2e-65], t$95$0, N[(y * (-z) + N[(0.5 * x), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(y, \log z, y\right)\\
\mathbf{if}\;z \leq 2.4 \cdot 10^{-265}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 6 \cdot 10^{-104}:\\
\;\;\;\;x \cdot \mathsf{fma}\left(\frac{y}{x}, -z, 0.5\right)\\
\mathbf{elif}\;z \leq 3.2 \cdot 10^{-65}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, -z, 0.5 \cdot x\right)\\
\end{array}
\end{array}
if z < 2.4e-265 or 6.0000000000000005e-104 < z < 3.1999999999999999e-65Initial program 99.8%
Taylor expanded in x around 0
sub-negN/A
associate-+r+N/A
mul-1-negN/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
accelerator-lowering-fma.f64N/A
mul-1-negN/A
sub-negN/A
--lowering--.f64N/A
log-lowering-log.f6469.3
Simplified69.3%
Taylor expanded in z around 0
log-lowering-log.f6469.3
Simplified69.3%
if 2.4e-265 < z < 6.0000000000000005e-104Initial program 99.7%
+-commutativeN/A
distribute-rgt-inN/A
associate-+l+N/A
accelerator-lowering-fma.f64N/A
--lowering--.f64N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
log-lowering-log.f64N/A
*-lowering-*.f6499.7
Applied egg-rr99.7%
Taylor expanded in x around inf
*-lowering-*.f64N/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
associate-/l*N/A
distribute-rgt-outN/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f64N/A
associate-+r-N/A
+-commutativeN/A
--lowering--.f64N/A
+-lowering-+.f64N/A
log-lowering-log.f6493.9
Simplified93.9%
Taylor expanded in z around inf
mul-1-negN/A
neg-lowering-neg.f6460.0
Simplified60.0%
if 3.1999999999999999e-65 < z Initial program 100.0%
+-commutativeN/A
distribute-rgt-inN/A
associate-+l+N/A
accelerator-lowering-fma.f64N/A
--lowering--.f64N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
log-lowering-log.f64N/A
*-lowering-*.f64100.0
Applied egg-rr100.0%
Taylor expanded in x around inf
*-lowering-*.f64N/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
associate-/l*N/A
distribute-rgt-outN/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f64N/A
associate-+r-N/A
+-commutativeN/A
--lowering--.f64N/A
+-lowering-+.f64N/A
log-lowering-log.f6489.5
Simplified89.5%
Taylor expanded in z around inf
mul-1-negN/A
neg-lowering-neg.f6484.6
Simplified84.6%
Taylor expanded in x around 0
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
accelerator-lowering-fma.f64N/A
mul-1-negN/A
neg-lowering-neg.f64N/A
*-lowering-*.f6493.2
Simplified93.2%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- (log z) z)))
(if (<= y -8.5e+54)
(+ y (* y t_0))
(if (<= y 1.5e+58) (fma y (- z) (* 0.5 x)) (fma y t_0 y)))))
double code(double x, double y, double z) {
double t_0 = log(z) - z;
double tmp;
if (y <= -8.5e+54) {
tmp = y + (y * t_0);
} else if (y <= 1.5e+58) {
tmp = fma(y, -z, (0.5 * x));
} else {
tmp = fma(y, t_0, y);
}
return tmp;
}
function code(x, y, z) t_0 = Float64(log(z) - z) tmp = 0.0 if (y <= -8.5e+54) tmp = Float64(y + Float64(y * t_0)); elseif (y <= 1.5e+58) tmp = fma(y, Float64(-z), Float64(0.5 * x)); else tmp = fma(y, t_0, y); end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Log[z], $MachinePrecision] - z), $MachinePrecision]}, If[LessEqual[y, -8.5e+54], N[(y + N[(y * t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.5e+58], N[(y * (-z) + N[(0.5 * x), $MachinePrecision]), $MachinePrecision], N[(y * t$95$0 + y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log z - z\\
\mathbf{if}\;y \leq -8.5 \cdot 10^{+54}:\\
\;\;\;\;y + y \cdot t\_0\\
\mathbf{elif}\;y \leq 1.5 \cdot 10^{+58}:\\
\;\;\;\;\mathsf{fma}\left(y, -z, 0.5 \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, t\_0, y\right)\\
\end{array}
\end{array}
if y < -8.4999999999999995e54Initial program 99.7%
Taylor expanded in x around 0
sub-negN/A
associate-+r+N/A
mul-1-negN/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
accelerator-lowering-fma.f64N/A
mul-1-negN/A
sub-negN/A
--lowering--.f64N/A
log-lowering-log.f6495.3
Simplified95.3%
+-lowering-+.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
log-lowering-log.f6495.3
Applied egg-rr95.3%
if -8.4999999999999995e54 < y < 1.5000000000000001e58Initial program 100.0%
+-commutativeN/A
distribute-rgt-inN/A
associate-+l+N/A
accelerator-lowering-fma.f64N/A
--lowering--.f64N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
log-lowering-log.f64N/A
*-lowering-*.f6499.9
Applied egg-rr99.9%
Taylor expanded in x around inf
*-lowering-*.f64N/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
associate-/l*N/A
distribute-rgt-outN/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f64N/A
associate-+r-N/A
+-commutativeN/A
--lowering--.f64N/A
+-lowering-+.f64N/A
log-lowering-log.f6494.9
Simplified94.9%
Taylor expanded in z around inf
mul-1-negN/A
neg-lowering-neg.f6482.3
Simplified82.3%
Taylor expanded in x around 0
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
accelerator-lowering-fma.f64N/A
mul-1-negN/A
neg-lowering-neg.f64N/A
*-lowering-*.f6487.3
Simplified87.3%
if 1.5000000000000001e58 < y Initial program 99.8%
Taylor expanded in x around 0
sub-negN/A
associate-+r+N/A
mul-1-negN/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
accelerator-lowering-fma.f64N/A
mul-1-negN/A
sub-negN/A
--lowering--.f64N/A
log-lowering-log.f6487.4
Simplified87.4%
Final simplification88.7%
(FPCore (x y z) :precision binary64 (let* ((t_0 (fma y (- (log z) z) y))) (if (<= y -2.6e+65) t_0 (if (<= y 1.25e+58) (fma y (- z) (* 0.5 x)) t_0))))
double code(double x, double y, double z) {
double t_0 = fma(y, (log(z) - z), y);
double tmp;
if (y <= -2.6e+65) {
tmp = t_0;
} else if (y <= 1.25e+58) {
tmp = fma(y, -z, (0.5 * x));
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = fma(y, Float64(log(z) - z), y) tmp = 0.0 if (y <= -2.6e+65) tmp = t_0; elseif (y <= 1.25e+58) tmp = fma(y, Float64(-z), Float64(0.5 * x)); else tmp = t_0; end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(y * N[(N[Log[z], $MachinePrecision] - z), $MachinePrecision] + y), $MachinePrecision]}, If[LessEqual[y, -2.6e+65], t$95$0, If[LessEqual[y, 1.25e+58], N[(y * (-z) + N[(0.5 * x), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(y, \log z - z, y\right)\\
\mathbf{if}\;y \leq -2.6 \cdot 10^{+65}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 1.25 \cdot 10^{+58}:\\
\;\;\;\;\mathsf{fma}\left(y, -z, 0.5 \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -2.60000000000000003e65 or 1.24999999999999996e58 < y Initial program 99.7%
Taylor expanded in x around 0
sub-negN/A
associate-+r+N/A
mul-1-negN/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
accelerator-lowering-fma.f64N/A
mul-1-negN/A
sub-negN/A
--lowering--.f64N/A
log-lowering-log.f6490.9
Simplified90.9%
if -2.60000000000000003e65 < y < 1.24999999999999996e58Initial program 100.0%
+-commutativeN/A
distribute-rgt-inN/A
associate-+l+N/A
accelerator-lowering-fma.f64N/A
--lowering--.f64N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
log-lowering-log.f64N/A
*-lowering-*.f6499.9
Applied egg-rr99.9%
Taylor expanded in x around inf
*-lowering-*.f64N/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
associate-/l*N/A
distribute-rgt-outN/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f64N/A
associate-+r-N/A
+-commutativeN/A
--lowering--.f64N/A
+-lowering-+.f64N/A
log-lowering-log.f6494.9
Simplified94.9%
Taylor expanded in z around inf
mul-1-negN/A
neg-lowering-neg.f6482.3
Simplified82.3%
Taylor expanded in x around 0
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
accelerator-lowering-fma.f64N/A
mul-1-negN/A
neg-lowering-neg.f64N/A
*-lowering-*.f6487.3
Simplified87.3%
(FPCore (x y z) :precision binary64 (if (<= z 2.4e-6) (fma 0.5 x (fma y (log z) y)) (fma (- 1.0 z) y (* 0.5 x))))
double code(double x, double y, double z) {
double tmp;
if (z <= 2.4e-6) {
tmp = fma(0.5, x, fma(y, log(z), y));
} else {
tmp = fma((1.0 - z), y, (0.5 * x));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (z <= 2.4e-6) tmp = fma(0.5, x, fma(y, log(z), y)); else tmp = fma(Float64(1.0 - z), y, Float64(0.5 * x)); end return tmp end
code[x_, y_, z_] := If[LessEqual[z, 2.4e-6], N[(0.5 * x + N[(y * N[Log[z], $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - z), $MachinePrecision] * y + N[(0.5 * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 2.4 \cdot 10^{-6}:\\
\;\;\;\;\mathsf{fma}\left(0.5, x, \mathsf{fma}\left(y, \log z, y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1 - z, y, 0.5 \cdot x\right)\\
\end{array}
\end{array}
if z < 2.3999999999999999e-6Initial program 99.8%
Taylor expanded in x around 0
sub-negN/A
associate-+r+N/A
mul-1-negN/A
distribute-lft-inN/A
*-rgt-identityN/A
associate-+r+N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
mul-1-negN/A
sub-negN/A
--lowering--.f64N/A
log-lowering-log.f64N/A
accelerator-lowering-fma.f6499.8
Simplified99.8%
Taylor expanded in z around 0
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
distribute-lft1-inN/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
distribute-lft1-inN/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
log-lowering-log.f6499.2
Simplified99.2%
if 2.3999999999999999e-6 < z Initial program 100.0%
+-commutativeN/A
distribute-rgt-inN/A
associate-+l+N/A
accelerator-lowering-fma.f64N/A
--lowering--.f64N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
log-lowering-log.f64N/A
*-lowering-*.f64100.0
Applied egg-rr100.0%
Taylor expanded in y around 0
*-lowering-*.f6498.6
Simplified98.6%
(FPCore (x y z) :precision binary64 (if (<= z 3.5e+32) (* 0.5 x) (- (* y z))))
double code(double x, double y, double z) {
double tmp;
if (z <= 3.5e+32) {
tmp = 0.5 * x;
} else {
tmp = -(y * z);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= 3.5d+32) then
tmp = 0.5d0 * x
else
tmp = -(y * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= 3.5e+32) {
tmp = 0.5 * x;
} else {
tmp = -(y * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 3.5e+32: tmp = 0.5 * x else: tmp = -(y * z) return tmp
function code(x, y, z) tmp = 0.0 if (z <= 3.5e+32) tmp = Float64(0.5 * x); else tmp = Float64(-Float64(y * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= 3.5e+32) tmp = 0.5 * x; else tmp = -(y * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 3.5e+32], N[(0.5 * x), $MachinePrecision], (-N[(y * z), $MachinePrecision])]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 3.5 \cdot 10^{+32}:\\
\;\;\;\;0.5 \cdot x\\
\mathbf{else}:\\
\;\;\;\;-y \cdot z\\
\end{array}
\end{array}
if z < 3.5000000000000001e32Initial program 99.8%
Taylor expanded in x around inf
*-lowering-*.f6452.0
Simplified52.0%
if 3.5000000000000001e32 < z Initial program 100.0%
Taylor expanded in z around inf
mul-1-negN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
neg-lowering-neg.f6471.1
Simplified71.1%
Final simplification60.1%
(FPCore (x y z) :precision binary64 (fma y (- z) (* 0.5 x)))
double code(double x, double y, double z) {
return fma(y, -z, (0.5 * x));
}
function code(x, y, z) return fma(y, Float64(-z), Float64(0.5 * x)) end
code[x_, y_, z_] := N[(y * (-z) + N[(0.5 * x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y, -z, 0.5 \cdot x\right)
\end{array}
Initial program 99.9%
+-commutativeN/A
distribute-rgt-inN/A
associate-+l+N/A
accelerator-lowering-fma.f64N/A
--lowering--.f64N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
log-lowering-log.f64N/A
*-lowering-*.f6499.8
Applied egg-rr99.8%
Taylor expanded in x around inf
*-lowering-*.f64N/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
associate-/l*N/A
distribute-rgt-outN/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f64N/A
associate-+r-N/A
+-commutativeN/A
--lowering--.f64N/A
+-lowering-+.f64N/A
log-lowering-log.f6489.9
Simplified89.9%
Taylor expanded in z around inf
mul-1-negN/A
neg-lowering-neg.f6469.7
Simplified69.7%
Taylor expanded in x around 0
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
accelerator-lowering-fma.f64N/A
mul-1-negN/A
neg-lowering-neg.f64N/A
*-lowering-*.f6474.5
Simplified74.5%
(FPCore (x y z) :precision binary64 (* 0.5 x))
double code(double x, double y, double z) {
return 0.5 * x;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = 0.5d0 * x
end function
public static double code(double x, double y, double z) {
return 0.5 * x;
}
def code(x, y, z): return 0.5 * x
function code(x, y, z) return Float64(0.5 * x) end
function tmp = code(x, y, z) tmp = 0.5 * x; end
code[x_, y_, z_] := N[(0.5 * x), $MachinePrecision]
\begin{array}{l}
\\
0.5 \cdot x
\end{array}
Initial program 99.9%
Taylor expanded in x around inf
*-lowering-*.f6442.0
Simplified42.0%
(FPCore (x y z) :precision binary64 y)
double code(double x, double y, double z) {
return y;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = y
end function
public static double code(double x, double y, double z) {
return y;
}
def code(x, y, z): return y
function code(x, y, z) return y end
function tmp = code(x, y, z) tmp = y; end
code[x_, y_, z_] := y
\begin{array}{l}
\\
y
\end{array}
Initial program 99.9%
Taylor expanded in x around 0
sub-negN/A
associate-+r+N/A
mul-1-negN/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
accelerator-lowering-fma.f64N/A
mul-1-negN/A
sub-negN/A
--lowering--.f64N/A
log-lowering-log.f6458.6
Simplified58.6%
Taylor expanded in z around inf
mul-1-negN/A
neg-lowering-neg.f6433.0
Simplified33.0%
Taylor expanded in z around 0
Simplified2.0%
(FPCore (x y z) :precision binary64 (- (+ y (* 0.5 x)) (* y (- z (log z)))))
double code(double x, double y, double z) {
return (y + (0.5 * x)) - (y * (z - log(z)));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (y + (0.5d0 * x)) - (y * (z - log(z)))
end function
public static double code(double x, double y, double z) {
return (y + (0.5 * x)) - (y * (z - Math.log(z)));
}
def code(x, y, z): return (y + (0.5 * x)) - (y * (z - math.log(z)))
function code(x, y, z) return Float64(Float64(y + Float64(0.5 * x)) - Float64(y * Float64(z - log(z)))) end
function tmp = code(x, y, z) tmp = (y + (0.5 * x)) - (y * (z - log(z))); end
code[x_, y_, z_] := N[(N[(y + N[(0.5 * x), $MachinePrecision]), $MachinePrecision] - N[(y * N[(z - N[Log[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(y + 0.5 \cdot x\right) - y \cdot \left(z - \log z\right)
\end{array}
herbie shell --seed 2024198
(FPCore (x y z)
:name "System.Random.MWC.Distributions:gamma from mwc-random-0.13.3.2"
:precision binary64
:alt
(! :herbie-platform default (- (+ y (* 1/2 x)) (* y (- z (log z)))))
(+ (* x 0.5) (* y (+ (- 1.0 z) (log z)))))