
(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 11 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 (+ 1.0 (- (log z) z)) y (* x 0.5)))
double code(double x, double y, double z) {
return fma((1.0 + (log(z) - z)), y, (x * 0.5));
}
function code(x, y, z) return fma(Float64(1.0 + Float64(log(z) - z)), y, Float64(x * 0.5)) end
code[x_, y_, z_] := N[(N[(1.0 + N[(N[Log[z], $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] * y + N[(x * 0.5), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(1 + \left(\log z - z\right), y, x \cdot 0.5\right)
\end{array}
Initial program 99.8%
+-commutative99.8%
*-commutative99.8%
fma-def99.9%
sub-neg99.9%
associate-+l+99.9%
+-commutative99.9%
sub-neg99.9%
Applied egg-rr99.9%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (if (<= (* x 0.5) -2e-24) (fma (- z) y (* x 0.5)) (if (<= (* x 0.5) 1e-81) (+ y (* (- (log z) z) y)) (- (* x 0.5) (* z y)))))
double code(double x, double y, double z) {
double tmp;
if ((x * 0.5) <= -2e-24) {
tmp = fma(-z, y, (x * 0.5));
} else if ((x * 0.5) <= 1e-81) {
tmp = y + ((log(z) - z) * y);
} else {
tmp = (x * 0.5) - (z * y);
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (Float64(x * 0.5) <= -2e-24) tmp = fma(Float64(-z), y, Float64(x * 0.5)); elseif (Float64(x * 0.5) <= 1e-81) tmp = Float64(y + Float64(Float64(log(z) - z) * y)); else tmp = Float64(Float64(x * 0.5) - Float64(z * y)); end return tmp end
code[x_, y_, z_] := If[LessEqual[N[(x * 0.5), $MachinePrecision], -2e-24], N[((-z) * y + N[(x * 0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * 0.5), $MachinePrecision], 1e-81], N[(y + N[(N[(N[Log[z], $MachinePrecision] - z), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], N[(N[(x * 0.5), $MachinePrecision] - N[(z * y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot 0.5 \leq -2 \cdot 10^{-24}:\\
\;\;\;\;\mathsf{fma}\left(-z, y, x \cdot 0.5\right)\\
\mathbf{elif}\;x \cdot 0.5 \leq 10^{-81}:\\
\;\;\;\;y + \left(\log z - z\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;x \cdot 0.5 - z \cdot y\\
\end{array}
\end{array}
if (*.f64 x 1/2) < -1.99999999999999985e-24Initial program 99.9%
+-commutative99.9%
*-commutative99.9%
fma-def100.0%
sub-neg100.0%
associate-+l+100.0%
+-commutative100.0%
sub-neg100.0%
Applied egg-rr100.0%
Taylor expanded in z around inf 91.8%
mul-1-neg91.8%
Simplified91.8%
if -1.99999999999999985e-24 < (*.f64 x 1/2) < 9.9999999999999996e-82Initial program 99.7%
sub-neg99.7%
associate-+l+99.7%
distribute-lft-in99.7%
*-rgt-identity99.7%
associate-+r+99.7%
fma-def99.7%
+-commutative99.7%
unsub-neg99.7%
Simplified99.7%
Taylor expanded in x around 0 90.5%
if 9.9999999999999996e-82 < (*.f64 x 1/2) Initial program 100.0%
Taylor expanded in z around inf 89.1%
mul-1-neg89.1%
distribute-rgt-neg-out89.1%
Simplified89.1%
distribute-rgt-neg-out89.1%
unsub-neg89.1%
Applied egg-rr89.1%
Final simplification90.5%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* y (+ 1.0 (log z)))))
(if (<= z 9e-251)
(- (* x 0.5) (* z y))
(if (<= z 5e-211)
t_0
(if (<= z 3.1e-203)
(* x 0.5)
(if (<= z 3e-167) t_0 (fma (- z) y (* x 0.5))))))))
double code(double x, double y, double z) {
double t_0 = y * (1.0 + log(z));
double tmp;
if (z <= 9e-251) {
tmp = (x * 0.5) - (z * y);
} else if (z <= 5e-211) {
tmp = t_0;
} else if (z <= 3.1e-203) {
tmp = x * 0.5;
} else if (z <= 3e-167) {
tmp = t_0;
} else {
tmp = fma(-z, y, (x * 0.5));
}
return tmp;
}
function code(x, y, z) t_0 = Float64(y * Float64(1.0 + log(z))) tmp = 0.0 if (z <= 9e-251) tmp = Float64(Float64(x * 0.5) - Float64(z * y)); elseif (z <= 5e-211) tmp = t_0; elseif (z <= 3.1e-203) tmp = Float64(x * 0.5); elseif (z <= 3e-167) tmp = t_0; else tmp = fma(Float64(-z), y, Float64(x * 0.5)); end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(y * N[(1.0 + N[Log[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, 9e-251], N[(N[(x * 0.5), $MachinePrecision] - N[(z * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5e-211], t$95$0, If[LessEqual[z, 3.1e-203], N[(x * 0.5), $MachinePrecision], If[LessEqual[z, 3e-167], t$95$0, N[((-z) * y + N[(x * 0.5), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y \cdot \left(1 + \log z\right)\\
\mathbf{if}\;z \leq 9 \cdot 10^{-251}:\\
\;\;\;\;x \cdot 0.5 - z \cdot y\\
\mathbf{elif}\;z \leq 5 \cdot 10^{-211}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 3.1 \cdot 10^{-203}:\\
\;\;\;\;x \cdot 0.5\\
\mathbf{elif}\;z \leq 3 \cdot 10^{-167}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-z, y, x \cdot 0.5\right)\\
\end{array}
\end{array}
if z < 8.99999999999999956e-251Initial program 100.0%
Taylor expanded in z around inf 67.9%
mul-1-neg67.9%
distribute-rgt-neg-out67.9%
Simplified67.9%
distribute-rgt-neg-out67.9%
unsub-neg67.9%
Applied egg-rr67.9%
if 8.99999999999999956e-251 < z < 5.0000000000000002e-211 or 3.09999999999999977e-203 < z < 2.9999999999999998e-167Initial program 99.6%
sub-neg99.6%
associate-+l+99.6%
distribute-lft-in99.5%
*-rgt-identity99.5%
associate-+r+99.5%
fma-def99.5%
+-commutative99.5%
unsub-neg99.5%
Simplified99.5%
Taylor expanded in z around 0 99.5%
Taylor expanded in y around inf 86.9%
if 5.0000000000000002e-211 < z < 3.09999999999999977e-203Initial program 100.0%
Taylor expanded in x around inf 100.0%
if 2.9999999999999998e-167 < z Initial program 99.9%
+-commutative99.9%
*-commutative99.9%
fma-def99.9%
sub-neg99.9%
associate-+l+99.9%
+-commutative99.9%
sub-neg99.9%
Applied egg-rr99.9%
Taylor expanded in z around inf 84.8%
mul-1-neg84.8%
Simplified84.8%
Final simplification84.2%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* y (+ 1.0 (log z)))) (t_1 (- (* x 0.5) (* z y))))
(if (<= z 1.1e-250)
t_1
(if (<= z 6.2e-211)
t_0
(if (<= z 1.1e-203) (* x 0.5) (if (<= z 6.2e-167) t_0 t_1))))))
double code(double x, double y, double z) {
double t_0 = y * (1.0 + log(z));
double t_1 = (x * 0.5) - (z * y);
double tmp;
if (z <= 1.1e-250) {
tmp = t_1;
} else if (z <= 6.2e-211) {
tmp = t_0;
} else if (z <= 1.1e-203) {
tmp = x * 0.5;
} else if (z <= 6.2e-167) {
tmp = t_0;
} else {
tmp = t_1;
}
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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = y * (1.0d0 + log(z))
t_1 = (x * 0.5d0) - (z * y)
if (z <= 1.1d-250) then
tmp = t_1
else if (z <= 6.2d-211) then
tmp = t_0
else if (z <= 1.1d-203) then
tmp = x * 0.5d0
else if (z <= 6.2d-167) then
tmp = t_0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = y * (1.0 + Math.log(z));
double t_1 = (x * 0.5) - (z * y);
double tmp;
if (z <= 1.1e-250) {
tmp = t_1;
} else if (z <= 6.2e-211) {
tmp = t_0;
} else if (z <= 1.1e-203) {
tmp = x * 0.5;
} else if (z <= 6.2e-167) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = y * (1.0 + math.log(z)) t_1 = (x * 0.5) - (z * y) tmp = 0 if z <= 1.1e-250: tmp = t_1 elif z <= 6.2e-211: tmp = t_0 elif z <= 1.1e-203: tmp = x * 0.5 elif z <= 6.2e-167: tmp = t_0 else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(y * Float64(1.0 + log(z))) t_1 = Float64(Float64(x * 0.5) - Float64(z * y)) tmp = 0.0 if (z <= 1.1e-250) tmp = t_1; elseif (z <= 6.2e-211) tmp = t_0; elseif (z <= 1.1e-203) tmp = Float64(x * 0.5); elseif (z <= 6.2e-167) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = y * (1.0 + log(z)); t_1 = (x * 0.5) - (z * y); tmp = 0.0; if (z <= 1.1e-250) tmp = t_1; elseif (z <= 6.2e-211) tmp = t_0; elseif (z <= 1.1e-203) tmp = x * 0.5; elseif (z <= 6.2e-167) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(y * N[(1.0 + N[Log[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x * 0.5), $MachinePrecision] - N[(z * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, 1.1e-250], t$95$1, If[LessEqual[z, 6.2e-211], t$95$0, If[LessEqual[z, 1.1e-203], N[(x * 0.5), $MachinePrecision], If[LessEqual[z, 6.2e-167], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y \cdot \left(1 + \log z\right)\\
t_1 := x \cdot 0.5 - z \cdot y\\
\mathbf{if}\;z \leq 1.1 \cdot 10^{-250}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 6.2 \cdot 10^{-211}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 1.1 \cdot 10^{-203}:\\
\;\;\;\;x \cdot 0.5\\
\mathbf{elif}\;z \leq 6.2 \cdot 10^{-167}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if z < 1.1e-250 or 6.2e-167 < z Initial program 99.9%
Taylor expanded in z around inf 83.3%
mul-1-neg83.3%
distribute-rgt-neg-out83.3%
Simplified83.3%
distribute-rgt-neg-out83.3%
unsub-neg83.3%
Applied egg-rr83.3%
if 1.1e-250 < z < 6.1999999999999999e-211 or 1.1e-203 < z < 6.2e-167Initial program 99.6%
sub-neg99.6%
associate-+l+99.6%
distribute-lft-in99.5%
*-rgt-identity99.5%
associate-+r+99.5%
fma-def99.5%
+-commutative99.5%
unsub-neg99.5%
Simplified99.5%
Taylor expanded in z around 0 99.5%
Taylor expanded in y around inf 86.9%
if 6.1999999999999999e-211 < z < 1.1e-203Initial program 100.0%
Taylor expanded in x around inf 100.0%
Final simplification84.2%
(FPCore (x y z) :precision binary64 (if (<= z 1.35e-12) (+ (* x 0.5) (* y (+ 1.0 (log z)))) (fma (- z) y (* x 0.5))))
double code(double x, double y, double z) {
double tmp;
if (z <= 1.35e-12) {
tmp = (x * 0.5) + (y * (1.0 + log(z)));
} else {
tmp = fma(-z, y, (x * 0.5));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (z <= 1.35e-12) tmp = Float64(Float64(x * 0.5) + Float64(y * Float64(1.0 + log(z)))); else tmp = fma(Float64(-z), y, Float64(x * 0.5)); end return tmp end
code[x_, y_, z_] := If[LessEqual[z, 1.35e-12], N[(N[(x * 0.5), $MachinePrecision] + N[(y * N[(1.0 + N[Log[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-z) * y + N[(x * 0.5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1.35 \cdot 10^{-12}:\\
\;\;\;\;x \cdot 0.5 + y \cdot \left(1 + \log z\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-z, y, x \cdot 0.5\right)\\
\end{array}
\end{array}
if z < 1.3499999999999999e-12Initial program 99.8%
Taylor expanded in z around 0 99.7%
if 1.3499999999999999e-12 < z Initial program 99.9%
+-commutative99.9%
*-commutative99.9%
fma-def100.0%
sub-neg100.0%
associate-+l+100.0%
+-commutative100.0%
sub-neg100.0%
Applied egg-rr100.0%
Taylor expanded in z around inf 97.8%
mul-1-neg97.8%
Simplified97.8%
Final simplification98.8%
(FPCore (x y z) :precision binary64 (+ (* x 0.5) (+ y (* (- (log z) z) y))))
double code(double x, double y, double z) {
return (x * 0.5) + (y + ((log(z) - z) * y));
}
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 + ((log(z) - z) * y))
end function
public static double code(double x, double y, double z) {
return (x * 0.5) + (y + ((Math.log(z) - z) * y));
}
def code(x, y, z): return (x * 0.5) + (y + ((math.log(z) - z) * y))
function code(x, y, z) return Float64(Float64(x * 0.5) + Float64(y + Float64(Float64(log(z) - z) * y))) end
function tmp = code(x, y, z) tmp = (x * 0.5) + (y + ((log(z) - z) * y)); end
code[x_, y_, z_] := N[(N[(x * 0.5), $MachinePrecision] + N[(y + N[(N[(N[Log[z], $MachinePrecision] - z), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot 0.5 + \left(y + \left(\log z - z\right) \cdot y\right)
\end{array}
Initial program 99.8%
sub-neg99.8%
associate-+l+99.8%
distribute-lft-in99.8%
*-rgt-identity99.8%
associate-+r+99.8%
fma-def99.8%
+-commutative99.8%
unsub-neg99.8%
Simplified99.8%
Taylor expanded in x around 0 99.8%
Final simplification99.8%
(FPCore (x y z) :precision binary64 (+ (* x 0.5) (* y (+ (log z) (- 1.0 z)))))
double code(double x, double y, double z) {
return (x * 0.5) + (y * (log(z) + (1.0 - 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 * (log(z) + (1.0d0 - z)))
end function
public static double code(double x, double y, double z) {
return (x * 0.5) + (y * (Math.log(z) + (1.0 - z)));
}
def code(x, y, z): return (x * 0.5) + (y * (math.log(z) + (1.0 - z)))
function code(x, y, z) return Float64(Float64(x * 0.5) + Float64(y * Float64(log(z) + Float64(1.0 - z)))) end
function tmp = code(x, y, z) tmp = (x * 0.5) + (y * (log(z) + (1.0 - z))); end
code[x_, y_, z_] := N[(N[(x * 0.5), $MachinePrecision] + N[(y * N[(N[Log[z], $MachinePrecision] + N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot 0.5 + y \cdot \left(\log z + \left(1 - z\right)\right)
\end{array}
Initial program 99.8%
Final simplification99.8%
(FPCore (x y z) :precision binary64 (- (* x 0.5) (* z y)))
double code(double x, double y, double z) {
return (x * 0.5) - (z * y);
}
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) - (z * y)
end function
public static double code(double x, double y, double z) {
return (x * 0.5) - (z * y);
}
def code(x, y, z): return (x * 0.5) - (z * y)
function code(x, y, z) return Float64(Float64(x * 0.5) - Float64(z * y)) end
function tmp = code(x, y, z) tmp = (x * 0.5) - (z * y); end
code[x_, y_, z_] := N[(N[(x * 0.5), $MachinePrecision] - N[(z * y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot 0.5 - z \cdot y
\end{array}
Initial program 99.8%
Taylor expanded in z around inf 73.8%
mul-1-neg73.8%
distribute-rgt-neg-out73.8%
Simplified73.8%
distribute-rgt-neg-out73.8%
unsub-neg73.8%
Applied egg-rr73.8%
Final simplification73.8%
(FPCore (x y z) :precision binary64 (if (<= z 6.2e+105) (* x 0.5) (* z (- y))))
double code(double x, double y, double z) {
double tmp;
if (z <= 6.2e+105) {
tmp = x * 0.5;
} else {
tmp = z * -y;
}
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 <= 6.2d+105) then
tmp = x * 0.5d0
else
tmp = z * -y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= 6.2e+105) {
tmp = x * 0.5;
} else {
tmp = z * -y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 6.2e+105: tmp = x * 0.5 else: tmp = z * -y return tmp
function code(x, y, z) tmp = 0.0 if (z <= 6.2e+105) tmp = Float64(x * 0.5); else tmp = Float64(z * Float64(-y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= 6.2e+105) tmp = x * 0.5; else tmp = z * -y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 6.2e+105], N[(x * 0.5), $MachinePrecision], N[(z * (-y)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 6.2 \cdot 10^{+105}:\\
\;\;\;\;x \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(-y\right)\\
\end{array}
\end{array}
if z < 6.20000000000000008e105Initial program 99.8%
Taylor expanded in x around inf 50.8%
if 6.20000000000000008e105 < z Initial program 100.0%
+-commutative100.0%
*-commutative100.0%
fma-def100.0%
sub-neg100.0%
associate-+l+100.0%
+-commutative100.0%
sub-neg100.0%
Applied egg-rr100.0%
Taylor expanded in z around inf 70.5%
mul-1-neg70.5%
*-commutative70.5%
distribute-rgt-neg-in70.5%
Simplified70.5%
Final simplification57.2%
(FPCore (x y z) :precision binary64 (* x 0.5))
double code(double x, double y, double z) {
return x * 0.5;
}
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
end function
public static double code(double x, double y, double z) {
return x * 0.5;
}
def code(x, y, z): return x * 0.5
function code(x, y, z) return Float64(x * 0.5) end
function tmp = code(x, y, z) tmp = x * 0.5; end
code[x_, y_, z_] := N[(x * 0.5), $MachinePrecision]
\begin{array}{l}
\\
x \cdot 0.5
\end{array}
Initial program 99.8%
Taylor expanded in x around inf 44.2%
Final simplification44.2%
(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.8%
sub-neg99.8%
associate-+l+99.8%
distribute-lft-in99.8%
*-rgt-identity99.8%
associate-+r+99.8%
fma-def99.8%
+-commutative99.8%
unsub-neg99.8%
Simplified99.8%
Taylor expanded in x around 0 57.0%
Taylor expanded in z around 0 27.0%
add-cube-cbrt26.6%
pow326.6%
*-commutative26.6%
Applied egg-rr26.6%
Taylor expanded in y around 0 1.8%
Final simplification1.8%
(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 2023187
(FPCore (x y z)
:name "System.Random.MWC.Distributions:gamma from mwc-random-0.13.3.2"
:precision binary64
:herbie-target
(- (+ y (* 0.5 x)) (* y (- z (log z))))
(+ (* x 0.5) (* y (+ (- 1.0 z) (log z)))))