
(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 12 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 x 0.5 y) (* y (- (log z) z))))
double code(double x, double y, double z) {
return fma(x, 0.5, y) + (y * (log(z) - z));
}
function code(x, y, z) return Float64(fma(x, 0.5, y) + Float64(y * Float64(log(z) - z))) end
code[x_, y_, z_] := N[(N[(x * 0.5 + y), $MachinePrecision] + N[(y * N[(N[Log[z], $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x, 0.5, y\right) + y \cdot \left(\log z - z\right)
\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%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (if (or (<= (* x 0.5) -5e-110) (not (<= (* x 0.5) 1e+26))) (- (* 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) <= -5e-110) || !((x * 0.5) <= 1e+26)) {
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) <= (-5d-110)) .or. (.not. ((x * 0.5d0) <= 1d+26))) 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) <= -5e-110) || !((x * 0.5) <= 1e+26)) {
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) <= -5e-110) or not ((x * 0.5) <= 1e+26): 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) <= -5e-110) || !(Float64(x * 0.5) <= 1e+26)) 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) <= -5e-110) || ~(((x * 0.5) <= 1e+26))) 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], -5e-110], N[Not[LessEqual[N[(x * 0.5), $MachinePrecision], 1e+26]], $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 -5 \cdot 10^{-110} \lor \neg \left(x \cdot 0.5 \leq 10^{+26}\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) < -5e-110 or 1.00000000000000005e26 < (*.f64 x 1/2) Initial program 100.0%
Taylor expanded in z around inf 85.7%
mul-1-neg85.7%
distribute-rgt-neg-out85.7%
Simplified85.7%
*-commutative85.7%
distribute-rgt-neg-out85.7%
unsub-neg85.7%
*-commutative85.7%
Applied egg-rr85.7%
if -5e-110 < (*.f64 x 1/2) < 1.00000000000000005e26Initial program 99.7%
sub-neg99.7%
associate-+l+99.7%
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 90.1%
mul-1-neg90.1%
distribute-rgt-neg-in90.1%
sub-neg90.1%
mul-1-neg90.1%
sub-neg90.1%
+-commutative90.1%
distribute-neg-in90.1%
remove-double-neg90.1%
sub-neg90.1%
metadata-eval90.1%
+-commutative90.1%
Simplified90.1%
add-cube-cbrt89.0%
pow389.1%
Applied egg-rr89.1%
Taylor expanded in y around 0 90.1%
*-commutative90.1%
pow-base-190.1%
*-rgt-identity90.1%
Simplified90.1%
Final simplification87.5%
(FPCore (x y z) :precision binary64 (if (or (<= (* x 0.5) -5e-110) (not (<= (* x 0.5) 1e+26))) (- (* x 0.5) (* y z)) (+ y (* y (- (log z) z)))))
double code(double x, double y, double z) {
double tmp;
if (((x * 0.5) <= -5e-110) || !((x * 0.5) <= 1e+26)) {
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) <= (-5d-110)) .or. (.not. ((x * 0.5d0) <= 1d+26))) 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) <= -5e-110) || !((x * 0.5) <= 1e+26)) {
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) <= -5e-110) or not ((x * 0.5) <= 1e+26): 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) <= -5e-110) || !(Float64(x * 0.5) <= 1e+26)) 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) <= -5e-110) || ~(((x * 0.5) <= 1e+26))) 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], -5e-110], N[Not[LessEqual[N[(x * 0.5), $MachinePrecision], 1e+26]], $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 -5 \cdot 10^{-110} \lor \neg \left(x \cdot 0.5 \leq 10^{+26}\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) < -5e-110 or 1.00000000000000005e26 < (*.f64 x 1/2) Initial program 100.0%
Taylor expanded in z around inf 85.7%
mul-1-neg85.7%
distribute-rgt-neg-out85.7%
Simplified85.7%
*-commutative85.7%
distribute-rgt-neg-out85.7%
unsub-neg85.7%
*-commutative85.7%
Applied egg-rr85.7%
if -5e-110 < (*.f64 x 1/2) < 1.00000000000000005e26Initial program 99.7%
sub-neg99.7%
associate-+l+99.7%
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 90.1%
Final simplification87.5%
(FPCore (x y z)
:precision binary64
(if (or (<= z 5.4e-189)
(not (or (<= z 5.8e-92) (and (not (<= z 3.6e-66)) (<= z 2.9e-24)))))
(- (* x 0.5) (* y z))
(* y (+ (log z) 1.0))))
double code(double x, double y, double z) {
double tmp;
if ((z <= 5.4e-189) || !((z <= 5.8e-92) || (!(z <= 3.6e-66) && (z <= 2.9e-24)))) {
tmp = (x * 0.5) - (y * z);
} else {
tmp = y * (log(z) + 1.0);
}
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.4d-189) .or. (.not. (z <= 5.8d-92) .or. (.not. (z <= 3.6d-66)) .and. (z <= 2.9d-24))) then
tmp = (x * 0.5d0) - (y * z)
else
tmp = y * (log(z) + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= 5.4e-189) || !((z <= 5.8e-92) || (!(z <= 3.6e-66) && (z <= 2.9e-24)))) {
tmp = (x * 0.5) - (y * z);
} else {
tmp = y * (Math.log(z) + 1.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= 5.4e-189) or not ((z <= 5.8e-92) or (not (z <= 3.6e-66) and (z <= 2.9e-24))): tmp = (x * 0.5) - (y * z) else: tmp = y * (math.log(z) + 1.0) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= 5.4e-189) || !((z <= 5.8e-92) || (!(z <= 3.6e-66) && (z <= 2.9e-24)))) tmp = Float64(Float64(x * 0.5) - Float64(y * z)); else tmp = Float64(y * Float64(log(z) + 1.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= 5.4e-189) || ~(((z <= 5.8e-92) || (~((z <= 3.6e-66)) && (z <= 2.9e-24))))) tmp = (x * 0.5) - (y * z); else tmp = y * (log(z) + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, 5.4e-189], N[Not[Or[LessEqual[z, 5.8e-92], And[N[Not[LessEqual[z, 3.6e-66]], $MachinePrecision], LessEqual[z, 2.9e-24]]]], $MachinePrecision]], N[(N[(x * 0.5), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision], N[(y * N[(N[Log[z], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 5.4 \cdot 10^{-189} \lor \neg \left(z \leq 5.8 \cdot 10^{-92} \lor \neg \left(z \leq 3.6 \cdot 10^{-66}\right) \land z \leq 2.9 \cdot 10^{-24}\right):\\
\;\;\;\;x \cdot 0.5 - y \cdot z\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(\log z + 1\right)\\
\end{array}
\end{array}
if z < 5.3999999999999999e-189 or 5.79999999999999969e-92 < z < 3.60000000000000012e-66 or 2.8999999999999999e-24 < z Initial program 99.9%
Taylor expanded in z around inf 87.1%
mul-1-neg87.1%
distribute-rgt-neg-out87.1%
Simplified87.1%
*-commutative87.1%
distribute-rgt-neg-out87.1%
unsub-neg87.1%
*-commutative87.1%
Applied egg-rr87.1%
if 5.3999999999999999e-189 < z < 5.79999999999999969e-92 or 3.60000000000000012e-66 < z < 2.8999999999999999e-24Initial program 99.7%
sub-neg99.7%
associate-+l+99.7%
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.8%
Taylor expanded in y around inf 67.8%
Final simplification82.7%
(FPCore (x y z)
:precision binary64
(if (or (<= z 7.2e-188)
(and (not (<= z 1.45e-91)) (or (<= z 4e-65) (not (<= z 2.3e-24)))))
(- (* x 0.5) (* y z))
(+ y (* y (log z)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= 7.2e-188) || (!(z <= 1.45e-91) && ((z <= 4e-65) || !(z <= 2.3e-24)))) {
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 ((z <= 7.2d-188) .or. (.not. (z <= 1.45d-91)) .and. (z <= 4d-65) .or. (.not. (z <= 2.3d-24))) 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 ((z <= 7.2e-188) || (!(z <= 1.45e-91) && ((z <= 4e-65) || !(z <= 2.3e-24)))) {
tmp = (x * 0.5) - (y * z);
} else {
tmp = y + (y * Math.log(z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= 7.2e-188) or (not (z <= 1.45e-91) and ((z <= 4e-65) or not (z <= 2.3e-24))): tmp = (x * 0.5) - (y * z) else: tmp = y + (y * math.log(z)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= 7.2e-188) || (!(z <= 1.45e-91) && ((z <= 4e-65) || !(z <= 2.3e-24)))) 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 ((z <= 7.2e-188) || (~((z <= 1.45e-91)) && ((z <= 4e-65) || ~((z <= 2.3e-24))))) tmp = (x * 0.5) - (y * z); else tmp = y + (y * log(z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, 7.2e-188], And[N[Not[LessEqual[z, 1.45e-91]], $MachinePrecision], Or[LessEqual[z, 4e-65], N[Not[LessEqual[z, 2.3e-24]], $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}\;z \leq 7.2 \cdot 10^{-188} \lor \neg \left(z \leq 1.45 \cdot 10^{-91}\right) \land \left(z \leq 4 \cdot 10^{-65} \lor \neg \left(z \leq 2.3 \cdot 10^{-24}\right)\right):\\
\;\;\;\;x \cdot 0.5 - y \cdot z\\
\mathbf{else}:\\
\;\;\;\;y + y \cdot \log z\\
\end{array}
\end{array}
if z < 7.1999999999999994e-188 or 1.45e-91 < z < 3.99999999999999969e-65 or 2.3000000000000001e-24 < z Initial program 99.9%
Taylor expanded in z around inf 87.1%
mul-1-neg87.1%
distribute-rgt-neg-out87.1%
Simplified87.1%
*-commutative87.1%
distribute-rgt-neg-out87.1%
unsub-neg87.1%
*-commutative87.1%
Applied egg-rr87.1%
if 7.1999999999999994e-188 < z < 1.45e-91 or 3.99999999999999969e-65 < z < 2.3000000000000001e-24Initial program 99.7%
sub-neg99.7%
associate-+l+99.7%
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.8%
Taylor expanded in x around 0 67.9%
Final simplification82.7%
(FPCore (x y z) :precision binary64 (if (<= z 0.28) (+ (* y (log z)) (+ y (* x 0.5))) (- (* x 0.5) (* y z))))
double code(double x, double y, double z) {
double tmp;
if (z <= 0.28) {
tmp = (y * log(z)) + (y + (x * 0.5));
} 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)) + (y + (x * 0.5d0))
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)) + (y + (x * 0.5));
} 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)) + (y + (x * 0.5)) 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(y + Float64(x * 0.5))); 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)) + (y + (x * 0.5)); 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[(y + N[(x * 0.5), $MachinePrecision]), $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(y + x \cdot 0.5\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.8%
*-rgt-identity99.8%
associate-+r+99.8%
fma-def99.8%
+-commutative99.8%
unsub-neg99.8%
Simplified99.8%
Taylor expanded in z around 0 98.8%
if 0.28000000000000003 < z Initial program 100.0%
Taylor expanded in z around inf 98.9%
mul-1-neg98.9%
distribute-rgt-neg-out98.9%
Simplified98.9%
*-commutative98.9%
distribute-rgt-neg-out98.9%
unsub-neg98.9%
*-commutative98.9%
Applied egg-rr98.9%
Final simplification98.9%
(FPCore (x y z) :precision binary64 (+ (* x 0.5) (* y (- (log z) (- z 1.0)))))
double code(double x, double y, double z) {
return (x * 0.5) + (y * (log(z) - (z - 1.0)));
}
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 - 1.0d0)))
end function
public static double code(double x, double y, double z) {
return (x * 0.5) + (y * (Math.log(z) - (z - 1.0)));
}
def code(x, y, z): return (x * 0.5) + (y * (math.log(z) - (z - 1.0)))
function code(x, y, z) return Float64(Float64(x * 0.5) + Float64(y * Float64(log(z) - Float64(z - 1.0)))) end
function tmp = code(x, y, z) tmp = (x * 0.5) + (y * (log(z) - (z - 1.0))); end
code[x_, y_, z_] := N[(N[(x * 0.5), $MachinePrecision] + N[(y * N[(N[Log[z], $MachinePrecision] - N[(z - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot 0.5 + y \cdot \left(\log z - \left(z - 1\right)\right)
\end{array}
Initial program 99.9%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (if (<= z 1.35e+56) (* x 0.5) (* y (- 1.0 z))))
double code(double x, double y, double z) {
double tmp;
if (z <= 1.35e+56) {
tmp = x * 0.5;
} else {
tmp = y * (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 (z <= 1.35d+56) then
tmp = x * 0.5d0
else
tmp = y * (1.0d0 - z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= 1.35e+56) {
tmp = x * 0.5;
} else {
tmp = y * (1.0 - z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 1.35e+56: tmp = x * 0.5 else: tmp = y * (1.0 - z) return tmp
function code(x, y, z) tmp = 0.0 if (z <= 1.35e+56) tmp = Float64(x * 0.5); else tmp = Float64(y * Float64(1.0 - z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= 1.35e+56) tmp = x * 0.5; else tmp = y * (1.0 - z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 1.35e+56], N[(x * 0.5), $MachinePrecision], N[(y * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1.35 \cdot 10^{+56}:\\
\;\;\;\;x \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(1 - z\right)\\
\end{array}
\end{array}
if z < 1.35000000000000005e56Initial program 99.8%
Taylor expanded in x around inf 51.0%
if 1.35000000000000005e56 < 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.0%
mul-1-neg74.0%
distribute-rgt-neg-in74.0%
sub-neg74.0%
mul-1-neg74.0%
sub-neg74.0%
+-commutative74.0%
distribute-neg-in74.0%
remove-double-neg74.0%
sub-neg74.0%
metadata-eval74.0%
+-commutative74.0%
Simplified74.0%
add-cube-cbrt73.3%
pow373.3%
Applied egg-rr73.3%
Taylor expanded in y around 0 74.0%
*-commutative74.0%
pow-base-174.0%
*-rgt-identity74.0%
Simplified74.0%
Taylor expanded in z around inf 74.0%
Final simplification60.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.9%
Taylor expanded in z around inf 75.4%
mul-1-neg75.4%
distribute-rgt-neg-out75.4%
Simplified75.4%
*-commutative75.4%
distribute-rgt-neg-out75.4%
unsub-neg75.4%
*-commutative75.4%
Applied egg-rr75.4%
Final simplification75.4%
(FPCore (x y z) :precision binary64 (if (<= z 2.3e+56) (* x 0.5) (* y (- z))))
double code(double x, double y, double z) {
double tmp;
if (z <= 2.3e+56) {
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 <= 2.3d+56) 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 <= 2.3e+56) {
tmp = x * 0.5;
} else {
tmp = y * -z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 2.3e+56: tmp = x * 0.5 else: tmp = y * -z return tmp
function code(x, y, z) tmp = 0.0 if (z <= 2.3e+56) 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 <= 2.3e+56) tmp = x * 0.5; else tmp = y * -z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 2.3e+56], N[(x * 0.5), $MachinePrecision], N[(y * (-z)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 2.3 \cdot 10^{+56}:\\
\;\;\;\;x \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(-z\right)\\
\end{array}
\end{array}
if z < 2.30000000000000015e56Initial program 99.8%
Taylor expanded in x around inf 51.0%
if 2.30000000000000015e56 < z Initial program 100.0%
Taylor expanded in z around inf 100.0%
mul-1-neg100.0%
distribute-rgt-neg-out100.0%
Simplified100.0%
Taylor expanded in x around 0 74.0%
associate-*r*74.0%
mul-1-neg74.0%
Simplified74.0%
Final simplification60.7%
(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 41.0%
Final simplification41.0%
(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 60.4%
mul-1-neg60.4%
distribute-rgt-neg-in60.4%
sub-neg60.4%
mul-1-neg60.4%
sub-neg60.4%
+-commutative60.4%
distribute-neg-in60.4%
remove-double-neg60.4%
sub-neg60.4%
metadata-eval60.4%
+-commutative60.4%
Simplified60.4%
add-cube-cbrt59.7%
pow359.7%
Applied egg-rr59.7%
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 2023185
(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)))))