
(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 (+ 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.9%
+-commutative99.9%
*-commutative99.9%
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 (or (<= (* x 0.5) -20000.0) (not (<= (* x 0.5) 1e-31))) (- (* x 0.5) (* z y)) (+ y (* y (- (log z) z)))))
double code(double x, double y, double z) {
double tmp;
if (((x * 0.5) <= -20000.0) || !((x * 0.5) <= 1e-31)) {
tmp = (x * 0.5) - (z * y);
} else {
tmp = y + (y * (log(z) - 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) <= (-20000.0d0)) .or. (.not. ((x * 0.5d0) <= 1d-31))) then
tmp = (x * 0.5d0) - (z * y)
else
tmp = y + (y * (log(z) - z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (((x * 0.5) <= -20000.0) || !((x * 0.5) <= 1e-31)) {
tmp = (x * 0.5) - (z * y);
} else {
tmp = y + (y * (Math.log(z) - z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if ((x * 0.5) <= -20000.0) or not ((x * 0.5) <= 1e-31): tmp = (x * 0.5) - (z * y) else: tmp = y + (y * (math.log(z) - z)) return tmp
function code(x, y, z) tmp = 0.0 if ((Float64(x * 0.5) <= -20000.0) || !(Float64(x * 0.5) <= 1e-31)) tmp = Float64(Float64(x * 0.5) - Float64(z * y)); else tmp = Float64(y + Float64(y * Float64(log(z) - z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (((x * 0.5) <= -20000.0) || ~(((x * 0.5) <= 1e-31))) tmp = (x * 0.5) - (z * y); else tmp = y + (y * (log(z) - z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[N[(x * 0.5), $MachinePrecision], -20000.0], N[Not[LessEqual[N[(x * 0.5), $MachinePrecision], 1e-31]], $MachinePrecision]], N[(N[(x * 0.5), $MachinePrecision] - N[(z * y), $MachinePrecision]), $MachinePrecision], N[(y + N[(y * N[(N[Log[z], $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot 0.5 \leq -20000 \lor \neg \left(x \cdot 0.5 \leq 10^{-31}\right):\\
\;\;\;\;x \cdot 0.5 - z \cdot y\\
\mathbf{else}:\\
\;\;\;\;y + y \cdot \left(\log z - z\right)\\
\end{array}
\end{array}
if (*.f64 x 1/2) < -2e4 or 1e-31 < (*.f64 x 1/2) Initial program 100.0%
add-cube-cbrt99.7%
pow399.7%
sub-neg99.7%
associate-+l+99.7%
+-commutative99.7%
sub-neg99.7%
Applied egg-rr99.7%
Taylor expanded in z around inf 88.0%
associate-*r*88.0%
neg-mul-188.0%
*-commutative88.0%
Simplified88.0%
*-commutative88.0%
distribute-rgt-neg-out88.0%
unsub-neg88.0%
*-commutative88.0%
Applied egg-rr88.0%
if -2e4 < (*.f64 x 1/2) < 1e-31Initial 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 84.1%
Final simplification86.2%
(FPCore (x y z) :precision binary64 (if (or (<= (* x 0.5) -20000.0) (not (<= (* x 0.5) 1e-31))) (- (* x 0.5) (* z y)) (* y (+ 1.0 (- (log z) z)))))
double code(double x, double y, double z) {
double tmp;
if (((x * 0.5) <= -20000.0) || !((x * 0.5) <= 1e-31)) {
tmp = (x * 0.5) - (z * y);
} else {
tmp = y * (1.0 + (log(z) - 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) <= (-20000.0d0)) .or. (.not. ((x * 0.5d0) <= 1d-31))) then
tmp = (x * 0.5d0) - (z * y)
else
tmp = y * (1.0d0 + (log(z) - z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (((x * 0.5) <= -20000.0) || !((x * 0.5) <= 1e-31)) {
tmp = (x * 0.5) - (z * y);
} else {
tmp = y * (1.0 + (Math.log(z) - z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if ((x * 0.5) <= -20000.0) or not ((x * 0.5) <= 1e-31): tmp = (x * 0.5) - (z * y) else: tmp = y * (1.0 + (math.log(z) - z)) return tmp
function code(x, y, z) tmp = 0.0 if ((Float64(x * 0.5) <= -20000.0) || !(Float64(x * 0.5) <= 1e-31)) tmp = Float64(Float64(x * 0.5) - Float64(z * y)); else tmp = Float64(y * Float64(1.0 + Float64(log(z) - z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (((x * 0.5) <= -20000.0) || ~(((x * 0.5) <= 1e-31))) tmp = (x * 0.5) - (z * y); else tmp = y * (1.0 + (log(z) - z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[N[(x * 0.5), $MachinePrecision], -20000.0], N[Not[LessEqual[N[(x * 0.5), $MachinePrecision], 1e-31]], $MachinePrecision]], N[(N[(x * 0.5), $MachinePrecision] - N[(z * y), $MachinePrecision]), $MachinePrecision], N[(y * N[(1.0 + N[(N[Log[z], $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot 0.5 \leq -20000 \lor \neg \left(x \cdot 0.5 \leq 10^{-31}\right):\\
\;\;\;\;x \cdot 0.5 - z \cdot y\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(1 + \left(\log z - z\right)\right)\\
\end{array}
\end{array}
if (*.f64 x 1/2) < -2e4 or 1e-31 < (*.f64 x 1/2) Initial program 100.0%
add-cube-cbrt99.7%
pow399.7%
sub-neg99.7%
associate-+l+99.7%
+-commutative99.7%
sub-neg99.7%
Applied egg-rr99.7%
Taylor expanded in z around inf 88.0%
associate-*r*88.0%
neg-mul-188.0%
*-commutative88.0%
Simplified88.0%
*-commutative88.0%
distribute-rgt-neg-out88.0%
unsub-neg88.0%
*-commutative88.0%
Applied egg-rr88.0%
if -2e4 < (*.f64 x 1/2) < 1e-31Initial 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 y around -inf 84.2%
mul-1-neg84.2%
distribute-rgt-neg-in84.2%
sub-neg84.2%
mul-1-neg84.2%
sub-neg84.2%
+-commutative84.2%
distribute-neg-in84.2%
remove-double-neg84.2%
sub-neg84.2%
metadata-eval84.2%
+-commutative84.2%
Simplified84.2%
Final simplification86.2%
(FPCore (x y z) :precision binary64 (if (<= z 0.28) (+ (* (log z) y) (+ y (* x 0.5))) (- (* x 0.5) (* z y))))
double code(double x, double y, double z) {
double tmp;
if (z <= 0.28) {
tmp = (log(z) * y) + (y + (x * 0.5));
} else {
tmp = (x * 0.5) - (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 <= 0.28d0) then
tmp = (log(z) * y) + (y + (x * 0.5d0))
else
tmp = (x * 0.5d0) - (z * y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= 0.28) {
tmp = (Math.log(z) * y) + (y + (x * 0.5));
} else {
tmp = (x * 0.5) - (z * y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 0.28: tmp = (math.log(z) * y) + (y + (x * 0.5)) else: tmp = (x * 0.5) - (z * y) return tmp
function code(x, y, z) tmp = 0.0 if (z <= 0.28) tmp = Float64(Float64(log(z) * y) + Float64(y + Float64(x * 0.5))); else tmp = Float64(Float64(x * 0.5) - Float64(z * y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= 0.28) tmp = (log(z) * y) + (y + (x * 0.5)); else tmp = (x * 0.5) - (z * y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 0.28], N[(N[(N[Log[z], $MachinePrecision] * y), $MachinePrecision] + N[(y + N[(x * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * 0.5), $MachinePrecision] - N[(z * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 0.28:\\
\;\;\;\;\log z \cdot y + \left(y + x \cdot 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 0.5 - z \cdot y\\
\end{array}
\end{array}
if z < 0.28000000000000003Initial 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 z around 0 99.0%
if 0.28000000000000003 < z Initial program 100.0%
add-cube-cbrt99.2%
pow399.1%
sub-neg99.1%
associate-+l+99.1%
+-commutative99.1%
sub-neg99.1%
Applied egg-rr99.1%
Taylor expanded in z around inf 98.1%
associate-*r*98.1%
neg-mul-198.1%
*-commutative98.1%
Simplified98.1%
*-commutative98.1%
distribute-rgt-neg-out98.1%
unsub-neg98.1%
*-commutative98.1%
Applied egg-rr98.1%
Final simplification98.5%
(FPCore (x y z) :precision binary64 (+ (* y (+ (log z) (- 1.0 z))) (* x 0.5)))
double code(double x, double y, double z) {
return (y * (log(z) + (1.0 - z))) + (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 = (y * (log(z) + (1.0d0 - z))) + (x * 0.5d0)
end function
public static double code(double x, double y, double z) {
return (y * (Math.log(z) + (1.0 - z))) + (x * 0.5);
}
def code(x, y, z): return (y * (math.log(z) + (1.0 - z))) + (x * 0.5)
function code(x, y, z) return Float64(Float64(y * Float64(log(z) + Float64(1.0 - z))) + Float64(x * 0.5)) end
function tmp = code(x, y, z) tmp = (y * (log(z) + (1.0 - z))) + (x * 0.5); end
code[x_, y_, z_] := N[(N[(y * N[(N[Log[z], $MachinePrecision] + N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x * 0.5), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y \cdot \left(\log z + \left(1 - z\right)\right) + x \cdot 0.5
\end{array}
Initial program 99.9%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(if (or (<= z 550000.0)
(and (not (<= z 6.5e+36))
(or (<= z 2.5e+80) (and (not (<= z 5.3e+132)) (<= z 3e+140)))))
(* x 0.5)
(* z (- y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= 550000.0) || (!(z <= 6.5e+36) && ((z <= 2.5e+80) || (!(z <= 5.3e+132) && (z <= 3e+140))))) {
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 <= 550000.0d0) .or. (.not. (z <= 6.5d+36)) .and. (z <= 2.5d+80) .or. (.not. (z <= 5.3d+132)) .and. (z <= 3d+140)) 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 <= 550000.0) || (!(z <= 6.5e+36) && ((z <= 2.5e+80) || (!(z <= 5.3e+132) && (z <= 3e+140))))) {
tmp = x * 0.5;
} else {
tmp = z * -y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= 550000.0) or (not (z <= 6.5e+36) and ((z <= 2.5e+80) or (not (z <= 5.3e+132) and (z <= 3e+140)))): tmp = x * 0.5 else: tmp = z * -y return tmp
function code(x, y, z) tmp = 0.0 if ((z <= 550000.0) || (!(z <= 6.5e+36) && ((z <= 2.5e+80) || (!(z <= 5.3e+132) && (z <= 3e+140))))) 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 <= 550000.0) || (~((z <= 6.5e+36)) && ((z <= 2.5e+80) || (~((z <= 5.3e+132)) && (z <= 3e+140))))) tmp = x * 0.5; else tmp = z * -y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, 550000.0], And[N[Not[LessEqual[z, 6.5e+36]], $MachinePrecision], Or[LessEqual[z, 2.5e+80], And[N[Not[LessEqual[z, 5.3e+132]], $MachinePrecision], LessEqual[z, 3e+140]]]]], N[(x * 0.5), $MachinePrecision], N[(z * (-y)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 550000 \lor \neg \left(z \leq 6.5 \cdot 10^{+36}\right) \land \left(z \leq 2.5 \cdot 10^{+80} \lor \neg \left(z \leq 5.3 \cdot 10^{+132}\right) \land z \leq 3 \cdot 10^{+140}\right):\\
\;\;\;\;x \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(-y\right)\\
\end{array}
\end{array}
if z < 5.5e5 or 6.4999999999999998e36 < z < 2.4999999999999998e80 or 5.3e132 < z < 2.99999999999999997e140Initial program 99.8%
Taylor expanded in x around inf 57.7%
if 5.5e5 < z < 6.4999999999999998e36 or 2.4999999999999998e80 < z < 5.3e132 or 2.99999999999999997e140 < 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 80.5%
associate-*r*80.5%
mul-1-neg80.5%
Simplified80.5%
Final simplification67.1%
(FPCore (x y z)
:precision binary64
(if (<= z 370000.0)
(* x 0.5)
(if (<= z 4.2e+36)
(- y (* z y))
(if (or (<= z 2.3e+80) (and (not (<= z 5.8e+132)) (<= z 3e+140)))
(* x 0.5)
(* z (- y))))))
double code(double x, double y, double z) {
double tmp;
if (z <= 370000.0) {
tmp = x * 0.5;
} else if (z <= 4.2e+36) {
tmp = y - (z * y);
} else if ((z <= 2.3e+80) || (!(z <= 5.8e+132) && (z <= 3e+140))) {
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 <= 370000.0d0) then
tmp = x * 0.5d0
else if (z <= 4.2d+36) then
tmp = y - (z * y)
else if ((z <= 2.3d+80) .or. (.not. (z <= 5.8d+132)) .and. (z <= 3d+140)) 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 <= 370000.0) {
tmp = x * 0.5;
} else if (z <= 4.2e+36) {
tmp = y - (z * y);
} else if ((z <= 2.3e+80) || (!(z <= 5.8e+132) && (z <= 3e+140))) {
tmp = x * 0.5;
} else {
tmp = z * -y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 370000.0: tmp = x * 0.5 elif z <= 4.2e+36: tmp = y - (z * y) elif (z <= 2.3e+80) or (not (z <= 5.8e+132) and (z <= 3e+140)): tmp = x * 0.5 else: tmp = z * -y return tmp
function code(x, y, z) tmp = 0.0 if (z <= 370000.0) tmp = Float64(x * 0.5); elseif (z <= 4.2e+36) tmp = Float64(y - Float64(z * y)); elseif ((z <= 2.3e+80) || (!(z <= 5.8e+132) && (z <= 3e+140))) 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 <= 370000.0) tmp = x * 0.5; elseif (z <= 4.2e+36) tmp = y - (z * y); elseif ((z <= 2.3e+80) || (~((z <= 5.8e+132)) && (z <= 3e+140))) tmp = x * 0.5; else tmp = z * -y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 370000.0], N[(x * 0.5), $MachinePrecision], If[LessEqual[z, 4.2e+36], N[(y - N[(z * y), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, 2.3e+80], And[N[Not[LessEqual[z, 5.8e+132]], $MachinePrecision], LessEqual[z, 3e+140]]], N[(x * 0.5), $MachinePrecision], N[(z * (-y)), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 370000:\\
\;\;\;\;x \cdot 0.5\\
\mathbf{elif}\;z \leq 4.2 \cdot 10^{+36}:\\
\;\;\;\;y - z \cdot y\\
\mathbf{elif}\;z \leq 2.3 \cdot 10^{+80} \lor \neg \left(z \leq 5.8 \cdot 10^{+132}\right) \land z \leq 3 \cdot 10^{+140}:\\
\;\;\;\;x \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(-y\right)\\
\end{array}
\end{array}
if z < 3.7e5 or 4.20000000000000009e36 < z < 2.30000000000000004e80 or 5.7999999999999997e132 < z < 2.99999999999999997e140Initial program 99.8%
Taylor expanded in x around inf 57.7%
if 3.7e5 < z < 4.20000000000000009e36Initial program 99.9%
sub-neg99.9%
associate-+l+99.9%
distribute-lft-in99.9%
*-rgt-identity99.9%
associate-+r+99.8%
fma-def99.8%
+-commutative99.8%
unsub-neg99.8%
Simplified99.8%
Taylor expanded in y around -inf 80.1%
mul-1-neg80.1%
distribute-rgt-neg-in80.1%
sub-neg80.1%
mul-1-neg80.1%
sub-neg80.1%
+-commutative80.1%
distribute-neg-in80.1%
remove-double-neg80.1%
sub-neg80.1%
metadata-eval80.1%
+-commutative80.1%
Simplified80.1%
Taylor expanded in z around inf 70.9%
Taylor expanded in y around 0 70.9%
sub-neg70.9%
distribute-lft-out70.9%
*-rgt-identity70.9%
distribute-rgt-neg-out70.9%
*-commutative70.9%
unsub-neg70.9%
*-commutative70.9%
Simplified70.9%
if 2.30000000000000004e80 < z < 5.7999999999999997e132 or 2.99999999999999997e140 < 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 82.0%
associate-*r*82.0%
mul-1-neg82.0%
Simplified82.0%
Final simplification67.1%
(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.9%
add-cube-cbrt99.2%
pow399.2%
sub-neg99.2%
associate-+l+99.2%
+-commutative99.2%
sub-neg99.2%
Applied egg-rr99.2%
Taylor expanded in z around inf 76.9%
associate-*r*76.9%
neg-mul-176.9%
*-commutative76.9%
Simplified76.9%
*-commutative76.9%
distribute-rgt-neg-out76.9%
unsub-neg76.9%
*-commutative76.9%
Applied egg-rr76.9%
Final simplification76.9%
(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 42.4%
Final simplification42.4%
(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.9%
*-rgt-identity99.9%
associate-+r+99.9%
fma-def99.9%
+-commutative99.9%
unsub-neg99.9%
Simplified99.9%
Taylor expanded in y around -inf 58.9%
mul-1-neg58.9%
distribute-rgt-neg-in58.9%
sub-neg58.9%
mul-1-neg58.9%
sub-neg58.9%
+-commutative58.9%
distribute-neg-in58.9%
remove-double-neg58.9%
sub-neg58.9%
metadata-eval58.9%
+-commutative58.9%
Simplified58.9%
Taylor expanded in z around inf 36.3%
Taylor expanded in z around 0 1.9%
Final simplification1.9%
(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 2023238
(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)))))