
(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 10 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 (+ (- 1.0 z) (log z)) (* x 0.5)))
double code(double x, double y, double z) {
return fma(y, ((1.0 - z) + log(z)), (x * 0.5));
}
function code(x, y, z) return fma(y, Float64(Float64(1.0 - z) + log(z)), Float64(x * 0.5)) end
code[x_, y_, z_] := N[(y * N[(N[(1.0 - z), $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision] + N[(x * 0.5), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y, \left(1 - z\right) + \log z, x \cdot 0.5\right)
\end{array}
Initial program 99.8%
+-commutative99.8%
fma-define99.9%
Simplified99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ y (* y (log z)))))
(if (<= z 2.5e-290)
(* x (- 0.5 (* z (* y (/ 1.0 x)))))
(if (<= z 3.2e-199)
t_0
(if (<= z 9.4e-122)
(- (* x 0.5) (* y z))
(if (<= z 2.25e-82) t_0 (fma y (- z) (* x 0.5))))))))
double code(double x, double y, double z) {
double t_0 = y + (y * log(z));
double tmp;
if (z <= 2.5e-290) {
tmp = x * (0.5 - (z * (y * (1.0 / x))));
} else if (z <= 3.2e-199) {
tmp = t_0;
} else if (z <= 9.4e-122) {
tmp = (x * 0.5) - (y * z);
} else if (z <= 2.25e-82) {
tmp = t_0;
} else {
tmp = fma(y, -z, (x * 0.5));
}
return tmp;
}
function code(x, y, z) t_0 = Float64(y + Float64(y * log(z))) tmp = 0.0 if (z <= 2.5e-290) tmp = Float64(x * Float64(0.5 - Float64(z * Float64(y * Float64(1.0 / x))))); elseif (z <= 3.2e-199) tmp = t_0; elseif (z <= 9.4e-122) tmp = Float64(Float64(x * 0.5) - Float64(y * z)); elseif (z <= 2.25e-82) tmp = t_0; else tmp = fma(y, Float64(-z), Float64(x * 0.5)); end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(y + N[(y * N[Log[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, 2.5e-290], N[(x * N[(0.5 - N[(z * N[(y * N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.2e-199], t$95$0, If[LessEqual[z, 9.4e-122], N[(N[(x * 0.5), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.25e-82], t$95$0, N[(y * (-z) + N[(x * 0.5), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y + y \cdot \log z\\
\mathbf{if}\;z \leq 2.5 \cdot 10^{-290}:\\
\;\;\;\;x \cdot \left(0.5 - z \cdot \left(y \cdot \frac{1}{x}\right)\right)\\
\mathbf{elif}\;z \leq 3.2 \cdot 10^{-199}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 9.4 \cdot 10^{-122}:\\
\;\;\;\;x \cdot 0.5 - y \cdot z\\
\mathbf{elif}\;z \leq 2.25 \cdot 10^{-82}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, -z, x \cdot 0.5\right)\\
\end{array}
\end{array}
if z < 2.5e-290Initial program 99.9%
Taylor expanded in z around inf 80.3%
associate-*r*80.3%
neg-mul-180.3%
Simplified80.3%
Taylor expanded in x around inf 80.3%
mul-1-neg80.3%
unsub-neg80.3%
associate-/l*80.3%
Simplified80.3%
clear-num80.3%
un-div-inv80.3%
Applied egg-rr80.3%
associate-/r/80.8%
associate-*l/80.3%
clear-num80.3%
associate-/r/80.3%
associate-*r*80.8%
Applied egg-rr80.8%
if 2.5e-290 < z < 3.1999999999999999e-199 or 9.3999999999999999e-122 < z < 2.2499999999999999e-82Initial program 99.7%
distribute-rgt-in99.6%
Applied egg-rr99.6%
Taylor expanded in x around 0 71.6%
Taylor expanded in z around 0 71.6%
if 3.1999999999999999e-199 < z < 9.3999999999999999e-122Initial program 99.8%
Taylor expanded in z around inf 67.7%
associate-*r*67.7%
neg-mul-167.7%
Simplified67.7%
fma-define67.7%
distribute-lft-neg-out67.7%
add-sqr-sqrt41.9%
sqrt-unprod63.7%
sqr-neg63.7%
sqrt-unprod25.4%
add-sqr-sqrt66.9%
fma-neg66.9%
*-commutative66.9%
add-sqr-sqrt25.4%
sqrt-unprod63.7%
sqr-neg63.7%
sqrt-unprod41.9%
add-sqr-sqrt67.7%
Applied egg-rr67.7%
if 2.2499999999999999e-82 < z Initial program 99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in z around inf 91.1%
neg-mul-191.1%
Simplified91.1%
Final simplification83.8%
(FPCore (x y z)
:precision binary64
(if (<= z 5e-291)
(* x (- 0.5 (* z (* y (/ 1.0 x)))))
(if (or (<= z 3.8e-199) (and (not (<= z 1.8e-125)) (<= z 2e-82)))
(+ y (* y (log z)))
(- (* x 0.5) (* y z)))))
double code(double x, double y, double z) {
double tmp;
if (z <= 5e-291) {
tmp = x * (0.5 - (z * (y * (1.0 / x))));
} else if ((z <= 3.8e-199) || (!(z <= 1.8e-125) && (z <= 2e-82))) {
tmp = y + (y * log(z));
} else {
tmp = (x * 0.5) - (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 <= 5d-291) then
tmp = x * (0.5d0 - (z * (y * (1.0d0 / x))))
else if ((z <= 3.8d-199) .or. (.not. (z <= 1.8d-125)) .and. (z <= 2d-82)) then
tmp = y + (y * log(z))
else
tmp = (x * 0.5d0) - (y * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= 5e-291) {
tmp = x * (0.5 - (z * (y * (1.0 / x))));
} else if ((z <= 3.8e-199) || (!(z <= 1.8e-125) && (z <= 2e-82))) {
tmp = y + (y * Math.log(z));
} else {
tmp = (x * 0.5) - (y * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 5e-291: tmp = x * (0.5 - (z * (y * (1.0 / x)))) elif (z <= 3.8e-199) or (not (z <= 1.8e-125) and (z <= 2e-82)): tmp = y + (y * math.log(z)) else: tmp = (x * 0.5) - (y * z) return tmp
function code(x, y, z) tmp = 0.0 if (z <= 5e-291) tmp = Float64(x * Float64(0.5 - Float64(z * Float64(y * Float64(1.0 / x))))); elseif ((z <= 3.8e-199) || (!(z <= 1.8e-125) && (z <= 2e-82))) tmp = Float64(y + Float64(y * log(z))); else tmp = Float64(Float64(x * 0.5) - Float64(y * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= 5e-291) tmp = x * (0.5 - (z * (y * (1.0 / x)))); elseif ((z <= 3.8e-199) || (~((z <= 1.8e-125)) && (z <= 2e-82))) tmp = y + (y * log(z)); else tmp = (x * 0.5) - (y * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 5e-291], N[(x * N[(0.5 - N[(z * N[(y * N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, 3.8e-199], And[N[Not[LessEqual[z, 1.8e-125]], $MachinePrecision], LessEqual[z, 2e-82]]], N[(y + N[(y * N[Log[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * 0.5), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 5 \cdot 10^{-291}:\\
\;\;\;\;x \cdot \left(0.5 - z \cdot \left(y \cdot \frac{1}{x}\right)\right)\\
\mathbf{elif}\;z \leq 3.8 \cdot 10^{-199} \lor \neg \left(z \leq 1.8 \cdot 10^{-125}\right) \land z \leq 2 \cdot 10^{-82}:\\
\;\;\;\;y + y \cdot \log z\\
\mathbf{else}:\\
\;\;\;\;x \cdot 0.5 - y \cdot z\\
\end{array}
\end{array}
if z < 5.0000000000000003e-291Initial program 99.9%
Taylor expanded in z around inf 80.3%
associate-*r*80.3%
neg-mul-180.3%
Simplified80.3%
Taylor expanded in x around inf 80.3%
mul-1-neg80.3%
unsub-neg80.3%
associate-/l*80.3%
Simplified80.3%
clear-num80.3%
un-div-inv80.3%
Applied egg-rr80.3%
associate-/r/80.8%
associate-*l/80.3%
clear-num80.3%
associate-/r/80.3%
associate-*r*80.8%
Applied egg-rr80.8%
if 5.0000000000000003e-291 < z < 3.7999999999999998e-199 or 1.8000000000000001e-125 < z < 2e-82Initial program 99.7%
distribute-rgt-in99.6%
Applied egg-rr99.6%
Taylor expanded in x around 0 71.6%
Taylor expanded in z around 0 71.6%
if 3.7999999999999998e-199 < z < 1.8000000000000001e-125 or 2e-82 < z Initial program 99.9%
Taylor expanded in z around inf 87.7%
associate-*r*87.7%
neg-mul-187.7%
Simplified87.7%
fma-define87.7%
distribute-lft-neg-out87.7%
add-sqr-sqrt41.5%
sqrt-unprod56.0%
sqr-neg56.0%
sqrt-unprod20.9%
add-sqr-sqrt40.6%
fma-neg40.6%
*-commutative40.6%
add-sqr-sqrt20.9%
sqrt-unprod56.0%
sqr-neg56.0%
sqrt-unprod41.5%
add-sqr-sqrt87.7%
Applied egg-rr87.7%
Final simplification83.8%
(FPCore (x y z) :precision binary64 (if (or (<= y -1.45e+49) (not (<= y 6.3e-24))) (* y (- (+ 1.0 (log z)) z)) (fma y (- z) (* x 0.5))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.45e+49) || !(y <= 6.3e-24)) {
tmp = y * ((1.0 + log(z)) - z);
} else {
tmp = fma(y, -z, (x * 0.5));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if ((y <= -1.45e+49) || !(y <= 6.3e-24)) tmp = Float64(y * Float64(Float64(1.0 + log(z)) - z)); else tmp = fma(y, Float64(-z), Float64(x * 0.5)); end return tmp end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.45e+49], N[Not[LessEqual[y, 6.3e-24]], $MachinePrecision]], N[(y * N[(N[(1.0 + N[Log[z], $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision], N[(y * (-z) + N[(x * 0.5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.45 \cdot 10^{+49} \lor \neg \left(y \leq 6.3 \cdot 10^{-24}\right):\\
\;\;\;\;y \cdot \left(\left(1 + \log z\right) - z\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, -z, x \cdot 0.5\right)\\
\end{array}
\end{array}
if y < -1.45e49 or 6.29999999999999979e-24 < y Initial program 99.7%
Taylor expanded in x around -inf 79.6%
mul-1-neg79.6%
*-commutative79.6%
distribute-rgt-neg-in79.6%
Simplified79.6%
Taylor expanded in y around -inf 86.8%
if -1.45e49 < y < 6.29999999999999979e-24Initial program 100.0%
+-commutative100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in z around inf 90.2%
neg-mul-190.2%
Simplified90.2%
Final simplification88.5%
(FPCore (x y z) :precision binary64 (if (<= z 0.27) (+ (* x 0.5) (+ y (* y (log z)))) (fma y (- z) (* x 0.5))))
double code(double x, double y, double z) {
double tmp;
if (z <= 0.27) {
tmp = (x * 0.5) + (y + (y * log(z)));
} else {
tmp = fma(y, -z, (x * 0.5));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (z <= 0.27) tmp = Float64(Float64(x * 0.5) + Float64(y + Float64(y * log(z)))); else tmp = fma(y, Float64(-z), Float64(x * 0.5)); end return tmp end
code[x_, y_, z_] := If[LessEqual[z, 0.27], N[(N[(x * 0.5), $MachinePrecision] + N[(y + N[(y * N[Log[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * (-z) + N[(x * 0.5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 0.27:\\
\;\;\;\;x \cdot 0.5 + \left(y + y \cdot \log z\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, -z, x \cdot 0.5\right)\\
\end{array}
\end{array}
if z < 0.27000000000000002Initial program 99.7%
distribute-rgt-in99.7%
Applied egg-rr99.7%
Taylor expanded in z around 0 97.9%
if 0.27000000000000002 < z Initial program 100.0%
+-commutative100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in z around inf 99.4%
neg-mul-199.4%
Simplified99.4%
Final simplification98.6%
(FPCore (x y z) :precision binary64 (if (<= z 0.27) (+ (* x 0.5) (* y (+ 1.0 (log z)))) (fma y (- z) (* x 0.5))))
double code(double x, double y, double z) {
double tmp;
if (z <= 0.27) {
tmp = (x * 0.5) + (y * (1.0 + log(z)));
} else {
tmp = fma(y, -z, (x * 0.5));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (z <= 0.27) tmp = Float64(Float64(x * 0.5) + Float64(y * Float64(1.0 + log(z)))); else tmp = fma(y, Float64(-z), Float64(x * 0.5)); end return tmp end
code[x_, y_, z_] := If[LessEqual[z, 0.27], N[(N[(x * 0.5), $MachinePrecision] + N[(y * N[(1.0 + N[Log[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * (-z) + N[(x * 0.5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 0.27:\\
\;\;\;\;x \cdot 0.5 + y \cdot \left(1 + \log z\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, -z, x \cdot 0.5\right)\\
\end{array}
\end{array}
if z < 0.27000000000000002Initial program 99.7%
Taylor expanded in z around 0 97.9%
*-commutative97.9%
Simplified97.9%
if 0.27000000000000002 < z Initial program 100.0%
+-commutative100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in z around inf 99.4%
neg-mul-199.4%
Simplified99.4%
Final simplification98.6%
(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}
Initial program 99.8%
(FPCore (x y z) :precision binary64 (if (<= z 5.2e+43) (* x 0.5) (* y (- z))))
double code(double x, double y, double z) {
double tmp;
if (z <= 5.2e+43) {
tmp = x * 0.5;
} 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 <= 5.2d+43) then
tmp = x * 0.5d0
else
tmp = y * -z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= 5.2e+43) {
tmp = x * 0.5;
} else {
tmp = y * -z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 5.2e+43: tmp = x * 0.5 else: tmp = y * -z return tmp
function code(x, y, z) tmp = 0.0 if (z <= 5.2e+43) tmp = Float64(x * 0.5); else tmp = Float64(y * Float64(-z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= 5.2e+43) tmp = x * 0.5; else tmp = y * -z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 5.2e+43], N[(x * 0.5), $MachinePrecision], N[(y * (-z)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 5.2 \cdot 10^{+43}:\\
\;\;\;\;x \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(-z\right)\\
\end{array}
\end{array}
if z < 5.20000000000000042e43Initial program 99.8%
Taylor expanded in z around inf 56.6%
associate-*r*56.6%
neg-mul-156.6%
Simplified56.6%
Taylor expanded in x around inf 50.4%
if 5.20000000000000042e43 < z Initial program 100.0%
Taylor expanded in z around inf 100.0%
associate-*r*100.0%
neg-mul-1100.0%
Simplified100.0%
Taylor expanded in x around 0 72.8%
mul-1-neg72.8%
*-commutative72.8%
distribute-rgt-neg-in72.8%
Simplified72.8%
Final simplification59.7%
(FPCore (x y z) :precision binary64 (- (* x 0.5) (* y z)))
double code(double x, double y, double z) {
return (x * 0.5) - (y * 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 * z)
end function
public static double code(double x, double y, double z) {
return (x * 0.5) - (y * z);
}
def code(x, y, z): return (x * 0.5) - (y * z)
function code(x, y, z) return Float64(Float64(x * 0.5) - Float64(y * z)) end
function tmp = code(x, y, z) tmp = (x * 0.5) - (y * z); end
code[x_, y_, z_] := N[(N[(x * 0.5), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot 0.5 - y \cdot z
\end{array}
Initial program 99.8%
Taylor expanded in z around inf 74.5%
associate-*r*74.5%
neg-mul-174.5%
Simplified74.5%
fma-define74.5%
distribute-lft-neg-out74.5%
add-sqr-sqrt35.7%
sqrt-unprod50.5%
sqr-neg50.5%
sqrt-unprod20.2%
add-sqr-sqrt39.7%
fma-neg39.7%
*-commutative39.7%
add-sqr-sqrt20.2%
sqrt-unprod50.5%
sqr-neg50.5%
sqrt-unprod35.7%
add-sqr-sqrt74.5%
Applied egg-rr74.5%
Final simplification74.5%
(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 z around inf 74.5%
associate-*r*74.5%
neg-mul-174.5%
Simplified74.5%
Taylor expanded in x around inf 40.8%
Final simplification40.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 2024135
(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)))))