
(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 (+ (* x 0.5) (* y (- (log (* z E)) z))))
double code(double x, double y, double z) {
return (x * 0.5) + (y * (log((z * ((double) M_E))) - z));
}
public static double code(double x, double y, double z) {
return (x * 0.5) + (y * (Math.log((z * Math.E)) - z));
}
def code(x, y, z): return (x * 0.5) + (y * (math.log((z * math.e)) - z))
function code(x, y, z) return Float64(Float64(x * 0.5) + Float64(y * Float64(log(Float64(z * exp(1))) - z))) end
function tmp = code(x, y, z) tmp = (x * 0.5) + (y * (log((z * 2.71828182845904523536)) - z)); end
code[x_, y_, z_] := N[(N[(x * 0.5), $MachinePrecision] + N[(y * N[(N[Log[N[(z * E), $MachinePrecision]], $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot 0.5 + y \cdot \left(\log \left(z \cdot e\right) - z\right)
\end{array}
Initial program 99.9%
+-commutative99.9%
associate-+r-99.9%
Applied egg-rr99.9%
add-log-exp99.9%
exp-sum99.9%
add-exp-log99.9%
exp-1-e99.9%
Applied egg-rr99.9%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* y (+ (log z) 1.0))) (t_1 (- (* x 0.5) (* y z))))
(if (<= z 3.1e-223)
t_1
(if (<= z 7e-188)
t_0
(if (<= z 1.25e-170)
(* x 0.5)
(if (or (<= z 6.2e-153) (and (not (<= z 8.1e-134)) (<= z 1.75e-99)))
t_0
t_1))))))
double code(double x, double y, double z) {
double t_0 = y * (log(z) + 1.0);
double t_1 = (x * 0.5) - (y * z);
double tmp;
if (z <= 3.1e-223) {
tmp = t_1;
} else if (z <= 7e-188) {
tmp = t_0;
} else if (z <= 1.25e-170) {
tmp = x * 0.5;
} else if ((z <= 6.2e-153) || (!(z <= 8.1e-134) && (z <= 1.75e-99))) {
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 * (log(z) + 1.0d0)
t_1 = (x * 0.5d0) - (y * z)
if (z <= 3.1d-223) then
tmp = t_1
else if (z <= 7d-188) then
tmp = t_0
else if (z <= 1.25d-170) then
tmp = x * 0.5d0
else if ((z <= 6.2d-153) .or. (.not. (z <= 8.1d-134)) .and. (z <= 1.75d-99)) 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 * (Math.log(z) + 1.0);
double t_1 = (x * 0.5) - (y * z);
double tmp;
if (z <= 3.1e-223) {
tmp = t_1;
} else if (z <= 7e-188) {
tmp = t_0;
} else if (z <= 1.25e-170) {
tmp = x * 0.5;
} else if ((z <= 6.2e-153) || (!(z <= 8.1e-134) && (z <= 1.75e-99))) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = y * (math.log(z) + 1.0) t_1 = (x * 0.5) - (y * z) tmp = 0 if z <= 3.1e-223: tmp = t_1 elif z <= 7e-188: tmp = t_0 elif z <= 1.25e-170: tmp = x * 0.5 elif (z <= 6.2e-153) or (not (z <= 8.1e-134) and (z <= 1.75e-99)): tmp = t_0 else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(y * Float64(log(z) + 1.0)) t_1 = Float64(Float64(x * 0.5) - Float64(y * z)) tmp = 0.0 if (z <= 3.1e-223) tmp = t_1; elseif (z <= 7e-188) tmp = t_0; elseif (z <= 1.25e-170) tmp = Float64(x * 0.5); elseif ((z <= 6.2e-153) || (!(z <= 8.1e-134) && (z <= 1.75e-99))) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = y * (log(z) + 1.0); t_1 = (x * 0.5) - (y * z); tmp = 0.0; if (z <= 3.1e-223) tmp = t_1; elseif (z <= 7e-188) tmp = t_0; elseif (z <= 1.25e-170) tmp = x * 0.5; elseif ((z <= 6.2e-153) || (~((z <= 8.1e-134)) && (z <= 1.75e-99))) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(y * N[(N[Log[z], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x * 0.5), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, 3.1e-223], t$95$1, If[LessEqual[z, 7e-188], t$95$0, If[LessEqual[z, 1.25e-170], N[(x * 0.5), $MachinePrecision], If[Or[LessEqual[z, 6.2e-153], And[N[Not[LessEqual[z, 8.1e-134]], $MachinePrecision], LessEqual[z, 1.75e-99]]], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y \cdot \left(\log z + 1\right)\\
t_1 := x \cdot 0.5 - y \cdot z\\
\mathbf{if}\;z \leq 3.1 \cdot 10^{-223}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 7 \cdot 10^{-188}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 1.25 \cdot 10^{-170}:\\
\;\;\;\;x \cdot 0.5\\
\mathbf{elif}\;z \leq 6.2 \cdot 10^{-153} \lor \neg \left(z \leq 8.1 \cdot 10^{-134}\right) \land z \leq 1.75 \cdot 10^{-99}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if z < 3.10000000000000018e-223 or 6.1999999999999999e-153 < z < 8.09999999999999989e-134 or 1.7499999999999999e-99 < z Initial program 99.9%
Taylor expanded in z around inf 86.2%
mul-1-neg86.2%
distribute-rgt-neg-out86.2%
Simplified86.2%
if 3.10000000000000018e-223 < z < 7.000000000000001e-188 or 1.25000000000000003e-170 < z < 6.1999999999999999e-153 or 8.09999999999999989e-134 < z < 1.7499999999999999e-99Initial program 99.7%
sub-neg99.7%
associate-+l+99.7%
distribute-lft-in99.5%
*-rgt-identity99.5%
associate-+r+99.6%
fma-def99.6%
+-commutative99.6%
unsub-neg99.6%
Simplified99.6%
Taylor expanded in x around 0 83.8%
Taylor expanded in z around 0 83.8%
*-commutative83.8%
distribute-lft1-in83.9%
Applied egg-rr83.9%
if 7.000000000000001e-188 < z < 1.25000000000000003e-170Initial program 100.0%
Taylor expanded in x around inf 100.0%
Final simplification86.2%
(FPCore (x y z) :precision binary64 (if (or (<= (* x 0.5) -5e-92) (not (<= (* x 0.5) 4e-32))) (- (* x 0.5) (* y z)) (* y (- (+ (log z) 1.0) z))))
double code(double x, double y, double z) {
double tmp;
if (((x * 0.5) <= -5e-92) || !((x * 0.5) <= 4e-32)) {
tmp = (x * 0.5) - (y * z);
} else {
tmp = y * ((log(z) + 1.0) - 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 (((x * 0.5d0) <= (-5d-92)) .or. (.not. ((x * 0.5d0) <= 4d-32))) then
tmp = (x * 0.5d0) - (y * z)
else
tmp = y * ((log(z) + 1.0d0) - z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (((x * 0.5) <= -5e-92) || !((x * 0.5) <= 4e-32)) {
tmp = (x * 0.5) - (y * z);
} else {
tmp = y * ((Math.log(z) + 1.0) - z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if ((x * 0.5) <= -5e-92) or not ((x * 0.5) <= 4e-32): tmp = (x * 0.5) - (y * z) else: tmp = y * ((math.log(z) + 1.0) - z) return tmp
function code(x, y, z) tmp = 0.0 if ((Float64(x * 0.5) <= -5e-92) || !(Float64(x * 0.5) <= 4e-32)) tmp = Float64(Float64(x * 0.5) - Float64(y * z)); else tmp = Float64(y * Float64(Float64(log(z) + 1.0) - z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (((x * 0.5) <= -5e-92) || ~(((x * 0.5) <= 4e-32))) tmp = (x * 0.5) - (y * z); else tmp = y * ((log(z) + 1.0) - z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[N[(x * 0.5), $MachinePrecision], -5e-92], N[Not[LessEqual[N[(x * 0.5), $MachinePrecision], 4e-32]], $MachinePrecision]], N[(N[(x * 0.5), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision], N[(y * N[(N[(N[Log[z], $MachinePrecision] + 1.0), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot 0.5 \leq -5 \cdot 10^{-92} \lor \neg \left(x \cdot 0.5 \leq 4 \cdot 10^{-32}\right):\\
\;\;\;\;x \cdot 0.5 - y \cdot z\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(\left(\log z + 1\right) - z\right)\\
\end{array}
\end{array}
if (*.f64 x 1/2) < -5.00000000000000011e-92 or 4.00000000000000022e-32 < (*.f64 x 1/2) Initial program 99.9%
Taylor expanded in z around inf 86.2%
mul-1-neg86.2%
distribute-rgt-neg-out86.2%
Simplified86.2%
if -5.00000000000000011e-92 < (*.f64 x 1/2) < 4.00000000000000022e-32Initial program 99.8%
sub-neg99.8%
associate-+l+99.8%
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 87.5%
Taylor expanded in y around 0 87.5%
Final simplification86.7%
(FPCore (x y z) :precision binary64 (if (<= z 1.05e-17) (+ (* x 0.5) (* y (+ (log z) 1.0))) (- (* x 0.5) (* y z))))
double code(double x, double y, double z) {
double tmp;
if (z <= 1.05e-17) {
tmp = (x * 0.5) + (y * (log(z) + 1.0));
} 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 <= 1.05d-17) then
tmp = (x * 0.5d0) + (y * (log(z) + 1.0d0))
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 <= 1.05e-17) {
tmp = (x * 0.5) + (y * (Math.log(z) + 1.0));
} else {
tmp = (x * 0.5) - (y * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 1.05e-17: tmp = (x * 0.5) + (y * (math.log(z) + 1.0)) else: tmp = (x * 0.5) - (y * z) return tmp
function code(x, y, z) tmp = 0.0 if (z <= 1.05e-17) tmp = Float64(Float64(x * 0.5) + Float64(y * Float64(log(z) + 1.0))); 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 <= 1.05e-17) tmp = (x * 0.5) + (y * (log(z) + 1.0)); else tmp = (x * 0.5) - (y * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 1.05e-17], N[(N[(x * 0.5), $MachinePrecision] + N[(y * N[(N[Log[z], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * 0.5), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1.05 \cdot 10^{-17}:\\
\;\;\;\;x \cdot 0.5 + y \cdot \left(\log z + 1\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 0.5 - y \cdot z\\
\end{array}
\end{array}
if z < 1.04999999999999996e-17Initial program 99.8%
Taylor expanded in z around 0 99.8%
if 1.04999999999999996e-17 < z Initial program 100.0%
Taylor expanded in z around inf 99.2%
mul-1-neg99.2%
distribute-rgt-neg-out99.2%
Simplified99.2%
Final simplification99.5%
(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.9%
Final simplification99.9%
(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(Float64(log(z) + 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[(N[Log[z], $MachinePrecision] + 1.0), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot 0.5 + y \cdot \left(\left(\log z + 1\right) - z\right)
\end{array}
Initial program 99.9%
+-commutative99.9%
associate-+r-99.9%
Applied egg-rr99.9%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (if (or (<= z 4.15e+55) (and (not (<= z 1.05e+175)) (<= z 4.2e+193))) (* x 0.5) (* y (- z))))
double code(double x, double y, double z) {
double tmp;
if ((z <= 4.15e+55) || (!(z <= 1.05e+175) && (z <= 4.2e+193))) {
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 <= 4.15d+55) .or. (.not. (z <= 1.05d+175)) .and. (z <= 4.2d+193)) 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 <= 4.15e+55) || (!(z <= 1.05e+175) && (z <= 4.2e+193))) {
tmp = x * 0.5;
} else {
tmp = y * -z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= 4.15e+55) or (not (z <= 1.05e+175) and (z <= 4.2e+193)): tmp = x * 0.5 else: tmp = y * -z return tmp
function code(x, y, z) tmp = 0.0 if ((z <= 4.15e+55) || (!(z <= 1.05e+175) && (z <= 4.2e+193))) 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 <= 4.15e+55) || (~((z <= 1.05e+175)) && (z <= 4.2e+193))) tmp = x * 0.5; else tmp = y * -z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, 4.15e+55], And[N[Not[LessEqual[z, 1.05e+175]], $MachinePrecision], LessEqual[z, 4.2e+193]]], N[(x * 0.5), $MachinePrecision], N[(y * (-z)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 4.15 \cdot 10^{+55} \lor \neg \left(z \leq 1.05 \cdot 10^{+175}\right) \land z \leq 4.2 \cdot 10^{+193}:\\
\;\;\;\;x \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(-z\right)\\
\end{array}
\end{array}
if z < 4.15000000000000024e55 or 1.05e175 < z < 4.2e193Initial program 99.8%
Taylor expanded in x around inf 56.2%
if 4.15000000000000024e55 < z < 1.05e175 or 4.2e193 < z Initial program 100.0%
sub-neg100.0%
associate-+l+100.0%
distribute-lft-in100.0%
*-rgt-identity100.0%
associate-+r+100.0%
fma-def100.0%
+-commutative100.0%
unsub-neg100.0%
Simplified100.0%
Taylor expanded in y around -inf 74.7%
mul-1-neg74.7%
distribute-rgt-neg-in74.7%
sub-neg74.7%
mul-1-neg74.7%
sub-neg74.7%
+-commutative74.7%
distribute-neg-in74.7%
remove-double-neg74.7%
sub-neg74.7%
metadata-eval74.7%
+-commutative74.7%
Simplified74.7%
Taylor expanded in z around inf 74.7%
Final simplification63.8%
(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.9%
Taylor expanded in z around inf 76.6%
mul-1-neg76.6%
distribute-rgt-neg-out76.6%
Simplified76.6%
Final simplification76.6%
(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.9%
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.9%
sub-neg99.9%
associate-+l+99.9%
distribute-lft-in99.8%
*-rgt-identity99.8%
associate-+r+99.8%
fma-def99.8%
+-commutative99.8%
unsub-neg99.8%
Simplified99.8%
Taylor expanded in y around -inf 57.1%
mul-1-neg57.1%
distribute-rgt-neg-in57.1%
sub-neg57.1%
mul-1-neg57.1%
sub-neg57.1%
+-commutative57.1%
distribute-neg-in57.1%
remove-double-neg57.1%
sub-neg57.1%
metadata-eval57.1%
+-commutative57.1%
Simplified57.1%
add-cube-cbrt56.5%
pow356.4%
Applied egg-rr56.4%
Taylor expanded in z around inf 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 2023200
(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)))))