
(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 (- (* x 0.5) (* y (- (+ z -1.0) (log z)))))
double code(double x, double y, double z) {
return (x * 0.5) - (y * ((z + -1.0) - 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 * ((z + (-1.0d0)) - log(z)))
end function
public static double code(double x, double y, double z) {
return (x * 0.5) - (y * ((z + -1.0) - Math.log(z)));
}
def code(x, y, z): return (x * 0.5) - (y * ((z + -1.0) - math.log(z)))
function code(x, y, z) return Float64(Float64(x * 0.5) - Float64(y * Float64(Float64(z + -1.0) - log(z)))) end
function tmp = code(x, y, z) tmp = (x * 0.5) - (y * ((z + -1.0) - log(z))); end
code[x_, y_, z_] := N[(N[(x * 0.5), $MachinePrecision] - N[(y * N[(N[(z + -1.0), $MachinePrecision] - N[Log[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot 0.5 - y \cdot \left(\left(z + -1\right) - \log z\right)
\end{array}
Initial program 99.9%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (if (or (<= (* x 0.5) -2e-57) (not (<= (* x 0.5) 5e-32))) (- (* x 0.5) (* y z)) (+ y (* y (- (log z) z)))))
double code(double x, double y, double z) {
double tmp;
if (((x * 0.5) <= -2e-57) || !((x * 0.5) <= 5e-32)) {
tmp = (x * 0.5) - (y * z);
} 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) <= (-2d-57)) .or. (.not. ((x * 0.5d0) <= 5d-32))) then
tmp = (x * 0.5d0) - (y * z)
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) <= -2e-57) || !((x * 0.5) <= 5e-32)) {
tmp = (x * 0.5) - (y * z);
} else {
tmp = y + (y * (Math.log(z) - z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if ((x * 0.5) <= -2e-57) or not ((x * 0.5) <= 5e-32): tmp = (x * 0.5) - (y * z) else: tmp = y + (y * (math.log(z) - z)) return tmp
function code(x, y, z) tmp = 0.0 if ((Float64(x * 0.5) <= -2e-57) || !(Float64(x * 0.5) <= 5e-32)) tmp = Float64(Float64(x * 0.5) - Float64(y * z)); 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) <= -2e-57) || ~(((x * 0.5) <= 5e-32))) tmp = (x * 0.5) - (y * z); else tmp = y + (y * (log(z) - z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[N[(x * 0.5), $MachinePrecision], -2e-57], N[Not[LessEqual[N[(x * 0.5), $MachinePrecision], 5e-32]], $MachinePrecision]], N[(N[(x * 0.5), $MachinePrecision] - N[(y * z), $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 -2 \cdot 10^{-57} \lor \neg \left(x \cdot 0.5 \leq 5 \cdot 10^{-32}\right):\\
\;\;\;\;x \cdot 0.5 - y \cdot z\\
\mathbf{else}:\\
\;\;\;\;y + y \cdot \left(\log z - z\right)\\
\end{array}
\end{array}
if (*.f64 x 1/2) < -1.99999999999999991e-57 or 5e-32 < (*.f64 x 1/2) Initial program 100.0%
Taylor expanded in z around inf 88.0%
mul-1-neg88.0%
distribute-rgt-neg-out88.0%
Simplified88.0%
if -1.99999999999999991e-57 < (*.f64 x 1/2) < 5e-32Initial 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.9%
Final simplification89.1%
(FPCore (x y z) :precision binary64 (if (or (<= (* x 0.5) -2e-57) (not (<= (* x 0.5) 5e-32))) (- (* x 0.5) (* y z)) (* y (+ 1.0 (- (log z) z)))))
double code(double x, double y, double z) {
double tmp;
if (((x * 0.5) <= -2e-57) || !((x * 0.5) <= 5e-32)) {
tmp = (x * 0.5) - (y * z);
} 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) <= (-2d-57)) .or. (.not. ((x * 0.5d0) <= 5d-32))) then
tmp = (x * 0.5d0) - (y * z)
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) <= -2e-57) || !((x * 0.5) <= 5e-32)) {
tmp = (x * 0.5) - (y * z);
} else {
tmp = y * (1.0 + (Math.log(z) - z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if ((x * 0.5) <= -2e-57) or not ((x * 0.5) <= 5e-32): tmp = (x * 0.5) - (y * z) else: tmp = y * (1.0 + (math.log(z) - z)) return tmp
function code(x, y, z) tmp = 0.0 if ((Float64(x * 0.5) <= -2e-57) || !(Float64(x * 0.5) <= 5e-32)) tmp = Float64(Float64(x * 0.5) - Float64(y * z)); 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) <= -2e-57) || ~(((x * 0.5) <= 5e-32))) tmp = (x * 0.5) - (y * z); 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], -2e-57], N[Not[LessEqual[N[(x * 0.5), $MachinePrecision], 5e-32]], $MachinePrecision]], N[(N[(x * 0.5), $MachinePrecision] - N[(y * z), $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 -2 \cdot 10^{-57} \lor \neg \left(x \cdot 0.5 \leq 5 \cdot 10^{-32}\right):\\
\;\;\;\;x \cdot 0.5 - y \cdot z\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(1 + \left(\log z - z\right)\right)\\
\end{array}
\end{array}
if (*.f64 x 1/2) < -1.99999999999999991e-57 or 5e-32 < (*.f64 x 1/2) Initial program 100.0%
Taylor expanded in z around inf 88.0%
mul-1-neg88.0%
distribute-rgt-neg-out88.0%
Simplified88.0%
if -1.99999999999999991e-57 < (*.f64 x 1/2) < 5e-32Initial 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 y around -inf 91.0%
mul-1-neg91.0%
distribute-rgt-neg-in91.0%
sub-neg91.0%
mul-1-neg91.0%
sub-neg91.0%
+-commutative91.0%
distribute-neg-in91.0%
remove-double-neg91.0%
sub-neg91.0%
metadata-eval91.0%
+-commutative91.0%
Simplified91.0%
Final simplification89.1%
(FPCore (x y z) :precision binary64 (if (or (<= (* x 0.5) 1e-260) (not (<= (* x 0.5) 5e-124))) (- (* x 0.5) (* y z)) (+ y (* y (log z)))))
double code(double x, double y, double z) {
double tmp;
if (((x * 0.5) <= 1e-260) || !((x * 0.5) <= 5e-124)) {
tmp = (x * 0.5) - (y * z);
} else {
tmp = y + (y * log(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) <= 1d-260) .or. (.not. ((x * 0.5d0) <= 5d-124))) then
tmp = (x * 0.5d0) - (y * z)
else
tmp = y + (y * log(z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (((x * 0.5) <= 1e-260) || !((x * 0.5) <= 5e-124)) {
tmp = (x * 0.5) - (y * z);
} else {
tmp = y + (y * Math.log(z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if ((x * 0.5) <= 1e-260) or not ((x * 0.5) <= 5e-124): tmp = (x * 0.5) - (y * z) else: tmp = y + (y * math.log(z)) return tmp
function code(x, y, z) tmp = 0.0 if ((Float64(x * 0.5) <= 1e-260) || !(Float64(x * 0.5) <= 5e-124)) tmp = Float64(Float64(x * 0.5) - Float64(y * z)); else tmp = Float64(y + Float64(y * log(z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (((x * 0.5) <= 1e-260) || ~(((x * 0.5) <= 5e-124))) tmp = (x * 0.5) - (y * z); else tmp = y + (y * log(z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[N[(x * 0.5), $MachinePrecision], 1e-260], N[Not[LessEqual[N[(x * 0.5), $MachinePrecision], 5e-124]], $MachinePrecision]], N[(N[(x * 0.5), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision], N[(y + N[(y * N[Log[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot 0.5 \leq 10^{-260} \lor \neg \left(x \cdot 0.5 \leq 5 \cdot 10^{-124}\right):\\
\;\;\;\;x \cdot 0.5 - y \cdot z\\
\mathbf{else}:\\
\;\;\;\;y + y \cdot \log z\\
\end{array}
\end{array}
if (*.f64 x 1/2) < 9.99999999999999961e-261 or 5.0000000000000003e-124 < (*.f64 x 1/2) Initial program 99.9%
Taylor expanded in z around inf 80.5%
mul-1-neg80.5%
distribute-rgt-neg-out80.5%
Simplified80.5%
if 9.99999999999999961e-261 < (*.f64 x 1/2) < 5.0000000000000003e-124Initial program 99.4%
sub-neg99.4%
associate-+l+99.4%
distribute-lft-in99.4%
*-rgt-identity99.4%
associate-+r+99.5%
fma-def99.5%
+-commutative99.5%
unsub-neg99.5%
Simplified99.5%
Taylor expanded in x around 0 90.8%
Taylor expanded in z around 0 70.9%
Final simplification79.7%
(FPCore (x y z) :precision binary64 (if (<= z 0.28) (+ (* y (log z)) (+ (* x 0.5) y)) (- (* x 0.5) (* y z))))
double code(double x, double y, double z) {
double tmp;
if (z <= 0.28) {
tmp = (y * log(z)) + ((x * 0.5) + y);
} 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 <= 0.28d0) then
tmp = (y * log(z)) + ((x * 0.5d0) + y)
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 <= 0.28) {
tmp = (y * Math.log(z)) + ((x * 0.5) + y);
} else {
tmp = (x * 0.5) - (y * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 0.28: tmp = (y * math.log(z)) + ((x * 0.5) + y) else: tmp = (x * 0.5) - (y * z) return tmp
function code(x, y, z) tmp = 0.0 if (z <= 0.28) tmp = Float64(Float64(y * log(z)) + Float64(Float64(x * 0.5) + y)); 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 <= 0.28) tmp = (y * log(z)) + ((x * 0.5) + y); else tmp = (x * 0.5) - (y * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 0.28], N[(N[(y * N[Log[z], $MachinePrecision]), $MachinePrecision] + N[(N[(x * 0.5), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision], N[(N[(x * 0.5), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 0.28:\\
\;\;\;\;y \cdot \log z + \left(x \cdot 0.5 + y\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 0.5 - y \cdot z\\
\end{array}
\end{array}
if z < 0.28000000000000003Initial 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 z around 0 99.4%
if 0.28000000000000003 < z Initial program 100.0%
Taylor expanded in z around inf 99.7%
mul-1-neg99.7%
distribute-rgt-neg-out99.7%
Simplified99.7%
Final simplification99.5%
(FPCore (x y z) :precision binary64 (if (or (<= z 8.8e+14) (and (not (<= z 2.6e+87)) (<= z 6.6e+127))) (* x 0.5) (* y (- z))))
double code(double x, double y, double z) {
double tmp;
if ((z <= 8.8e+14) || (!(z <= 2.6e+87) && (z <= 6.6e+127))) {
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 <= 8.8d+14) .or. (.not. (z <= 2.6d+87)) .and. (z <= 6.6d+127)) 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 <= 8.8e+14) || (!(z <= 2.6e+87) && (z <= 6.6e+127))) {
tmp = x * 0.5;
} else {
tmp = y * -z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= 8.8e+14) or (not (z <= 2.6e+87) and (z <= 6.6e+127)): tmp = x * 0.5 else: tmp = y * -z return tmp
function code(x, y, z) tmp = 0.0 if ((z <= 8.8e+14) || (!(z <= 2.6e+87) && (z <= 6.6e+127))) 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 <= 8.8e+14) || (~((z <= 2.6e+87)) && (z <= 6.6e+127))) tmp = x * 0.5; else tmp = y * -z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, 8.8e+14], And[N[Not[LessEqual[z, 2.6e+87]], $MachinePrecision], LessEqual[z, 6.6e+127]]], N[(x * 0.5), $MachinePrecision], N[(y * (-z)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 8.8 \cdot 10^{+14} \lor \neg \left(z \leq 2.6 \cdot 10^{+87}\right) \land z \leq 6.6 \cdot 10^{+127}:\\
\;\;\;\;x \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(-z\right)\\
\end{array}
\end{array}
if z < 8.8e14 or 2.59999999999999998e87 < z < 6.59999999999999953e127Initial program 99.8%
Taylor expanded in x around inf 56.8%
if 8.8e14 < z < 2.59999999999999998e87 or 6.59999999999999953e127 < 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 77.8%
mul-1-neg77.8%
distribute-rgt-neg-in77.8%
sub-neg77.8%
mul-1-neg77.8%
sub-neg77.8%
+-commutative77.8%
distribute-neg-in77.8%
remove-double-neg77.8%
sub-neg77.8%
metadata-eval77.8%
+-commutative77.8%
Simplified77.8%
Taylor expanded in z around inf 77.7%
Final simplification65.1%
(FPCore (x y z)
:precision binary64
(if (<= z 6.5e+14)
(* x 0.5)
(if (<= z 6.5e+87)
(* y (- 1.0 z))
(if (<= z 1.35e+124) (* x 0.5) (* y (- z))))))
double code(double x, double y, double z) {
double tmp;
if (z <= 6.5e+14) {
tmp = x * 0.5;
} else if (z <= 6.5e+87) {
tmp = y * (1.0 - z);
} else if (z <= 1.35e+124) {
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 <= 6.5d+14) then
tmp = x * 0.5d0
else if (z <= 6.5d+87) then
tmp = y * (1.0d0 - z)
else if (z <= 1.35d+124) 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 <= 6.5e+14) {
tmp = x * 0.5;
} else if (z <= 6.5e+87) {
tmp = y * (1.0 - z);
} else if (z <= 1.35e+124) {
tmp = x * 0.5;
} else {
tmp = y * -z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 6.5e+14: tmp = x * 0.5 elif z <= 6.5e+87: tmp = y * (1.0 - z) elif z <= 1.35e+124: tmp = x * 0.5 else: tmp = y * -z return tmp
function code(x, y, z) tmp = 0.0 if (z <= 6.5e+14) tmp = Float64(x * 0.5); elseif (z <= 6.5e+87) tmp = Float64(y * Float64(1.0 - z)); elseif (z <= 1.35e+124) 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 <= 6.5e+14) tmp = x * 0.5; elseif (z <= 6.5e+87) tmp = y * (1.0 - z); elseif (z <= 1.35e+124) tmp = x * 0.5; else tmp = y * -z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 6.5e+14], N[(x * 0.5), $MachinePrecision], If[LessEqual[z, 6.5e+87], N[(y * N[(1.0 - z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.35e+124], N[(x * 0.5), $MachinePrecision], N[(y * (-z)), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 6.5 \cdot 10^{+14}:\\
\;\;\;\;x \cdot 0.5\\
\mathbf{elif}\;z \leq 6.5 \cdot 10^{+87}:\\
\;\;\;\;y \cdot \left(1 - z\right)\\
\mathbf{elif}\;z \leq 1.35 \cdot 10^{+124}:\\
\;\;\;\;x \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(-z\right)\\
\end{array}
\end{array}
if z < 6.5e14 or 6.5000000000000002e87 < z < 1.34999999999999989e124Initial program 99.8%
Taylor expanded in x around inf 56.8%
if 6.5e14 < z < 6.5000000000000002e87Initial 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.9%
mul-1-neg74.9%
distribute-rgt-neg-in74.9%
sub-neg74.9%
mul-1-neg74.9%
sub-neg74.9%
+-commutative74.9%
distribute-neg-in74.9%
remove-double-neg74.9%
sub-neg74.9%
metadata-eval74.9%
+-commutative74.9%
Simplified74.9%
expm1-log1p-u71.2%
Applied egg-rr71.2%
Taylor expanded in z around inf 74.4%
if 1.34999999999999989e124 < 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 78.9%
mul-1-neg78.9%
distribute-rgt-neg-in78.9%
sub-neg78.9%
mul-1-neg78.9%
sub-neg78.9%
+-commutative78.9%
distribute-neg-in78.9%
remove-double-neg78.9%
sub-neg78.9%
metadata-eval78.9%
+-commutative78.9%
Simplified78.9%
Taylor expanded in z around inf 78.9%
Final simplification65.1%
(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.5%
mul-1-neg76.5%
distribute-rgt-neg-out76.5%
Simplified76.5%
Final simplification76.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.9%
Taylor expanded in x around inf 43.7%
Final simplification43.7%
(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 2023213
(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)))))