
(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 8 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 (+ (- 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.9%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (if (or (<= (* x 0.5) -2e-73) (not (<= (* x 0.5) 4e-110))) (- (* 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-73) || !((x * 0.5) <= 4e-110)) {
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-73)) .or. (.not. ((x * 0.5d0) <= 4d-110))) 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-73) || !((x * 0.5) <= 4e-110)) {
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-73) or not ((x * 0.5) <= 4e-110): 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-73) || !(Float64(x * 0.5) <= 4e-110)) tmp = Float64(Float64(x * 0.5) - Float64(y * z)); else tmp = Float64(y * Float64(Float64(1.0 + log(z)) - z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (((x * 0.5) <= -2e-73) || ~(((x * 0.5) <= 4e-110))) 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-73], N[Not[LessEqual[N[(x * 0.5), $MachinePrecision], 4e-110]], $MachinePrecision]], N[(N[(x * 0.5), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision], N[(y * N[(N[(1.0 + N[Log[z], $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot 0.5 \leq -2 \cdot 10^{-73} \lor \neg \left(x \cdot 0.5 \leq 4 \cdot 10^{-110}\right):\\
\;\;\;\;x \cdot 0.5 - y \cdot z\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(\left(1 + \log z\right) - z\right)\\
\end{array}
\end{array}
if (*.f64 x 1/2) < -1.99999999999999999e-73 or 4.0000000000000002e-110 < (*.f64 x 1/2) Initial program 100.0%
Taylor expanded in z around inf 87.1%
mul-1-neg87.1%
distribute-rgt-neg-out87.1%
Simplified87.1%
fma-def87.1%
distribute-rgt-neg-out87.1%
add-sqr-sqrt87.1%
sqrt-unprod67.2%
sqr-neg67.2%
sqrt-unprod0.0%
add-sqr-sqrt60.4%
fma-neg60.4%
add-sqr-sqrt0.0%
sqrt-unprod67.2%
sqr-neg67.2%
sqrt-unprod87.1%
add-sqr-sqrt87.1%
Applied egg-rr87.1%
if -1.99999999999999999e-73 < (*.f64 x 1/2) < 4.0000000000000002e-110Initial 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 91.7%
mul-1-neg91.7%
distribute-rgt-neg-in91.7%
sub-neg91.7%
mul-1-neg91.7%
sub-neg91.7%
+-commutative91.7%
distribute-neg-in91.7%
remove-double-neg91.7%
sub-neg91.7%
metadata-eval91.7%
+-commutative91.7%
Simplified91.7%
Taylor expanded in y around 0 91.7%
Final simplification88.8%
(FPCore (x y z) :precision binary64 (if (or (<= (* x 0.5) -1e-220) (not (<= (* x 0.5) 2e-282))) (- (* x 0.5) (* y z)) (* y (+ 1.0 (log z)))))
double code(double x, double y, double z) {
double tmp;
if (((x * 0.5) <= -1e-220) || !((x * 0.5) <= 2e-282)) {
tmp = (x * 0.5) - (y * z);
} else {
tmp = y * (1.0 + 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-220)) .or. (.not. ((x * 0.5d0) <= 2d-282))) then
tmp = (x * 0.5d0) - (y * z)
else
tmp = y * (1.0d0 + 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-220) || !((x * 0.5) <= 2e-282)) {
tmp = (x * 0.5) - (y * z);
} else {
tmp = y * (1.0 + Math.log(z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if ((x * 0.5) <= -1e-220) or not ((x * 0.5) <= 2e-282): tmp = (x * 0.5) - (y * z) else: tmp = y * (1.0 + math.log(z)) return tmp
function code(x, y, z) tmp = 0.0 if ((Float64(x * 0.5) <= -1e-220) || !(Float64(x * 0.5) <= 2e-282)) tmp = Float64(Float64(x * 0.5) - Float64(y * z)); else tmp = Float64(y * Float64(1.0 + log(z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (((x * 0.5) <= -1e-220) || ~(((x * 0.5) <= 2e-282))) tmp = (x * 0.5) - (y * z); else tmp = y * (1.0 + log(z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[N[(x * 0.5), $MachinePrecision], -1e-220], N[Not[LessEqual[N[(x * 0.5), $MachinePrecision], 2e-282]], $MachinePrecision]], N[(N[(x * 0.5), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision], N[(y * N[(1.0 + N[Log[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot 0.5 \leq -1 \cdot 10^{-220} \lor \neg \left(x \cdot 0.5 \leq 2 \cdot 10^{-282}\right):\\
\;\;\;\;x \cdot 0.5 - y \cdot z\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(1 + \log z\right)\\
\end{array}
\end{array}
if (*.f64 x 1/2) < -9.99999999999999992e-221 or 2e-282 < (*.f64 x 1/2) Initial program 99.9%
Taylor expanded in z around inf 79.6%
mul-1-neg79.6%
distribute-rgt-neg-out79.6%
Simplified79.6%
fma-def79.6%
distribute-rgt-neg-out79.6%
add-sqr-sqrt79.4%
sqrt-unprod59.7%
sqr-neg59.7%
sqrt-unprod0.0%
add-sqr-sqrt45.5%
fma-neg45.5%
add-sqr-sqrt0.0%
sqrt-unprod59.7%
sqr-neg59.7%
sqrt-unprod79.4%
add-sqr-sqrt79.6%
Applied egg-rr79.6%
if -9.99999999999999992e-221 < (*.f64 x 1/2) < 2e-282Initial program 99.6%
sub-neg99.6%
associate-+l+99.6%
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.9%
mul-1-neg91.9%
distribute-rgt-neg-in91.9%
sub-neg91.9%
mul-1-neg91.9%
sub-neg91.9%
+-commutative91.9%
distribute-neg-in91.9%
remove-double-neg91.9%
sub-neg91.9%
metadata-eval91.9%
+-commutative91.9%
Simplified91.9%
Taylor expanded in z around 0 67.3%
Final simplification78.4%
(FPCore (x y z) :precision binary64 (if (or (<= (* x 0.5) -1e-220) (not (<= (* x 0.5) 2e-282))) (- (* x 0.5) (* y z)) (+ y (* y (log z)))))
double code(double x, double y, double z) {
double tmp;
if (((x * 0.5) <= -1e-220) || !((x * 0.5) <= 2e-282)) {
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-220)) .or. (.not. ((x * 0.5d0) <= 2d-282))) 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-220) || !((x * 0.5) <= 2e-282)) {
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-220) or not ((x * 0.5) <= 2e-282): 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-220) || !(Float64(x * 0.5) <= 2e-282)) 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-220) || ~(((x * 0.5) <= 2e-282))) 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-220], N[Not[LessEqual[N[(x * 0.5), $MachinePrecision], 2e-282]], $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 -1 \cdot 10^{-220} \lor \neg \left(x \cdot 0.5 \leq 2 \cdot 10^{-282}\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.99999999999999992e-221 or 2e-282 < (*.f64 x 1/2) Initial program 99.9%
Taylor expanded in z around inf 79.6%
mul-1-neg79.6%
distribute-rgt-neg-out79.6%
Simplified79.6%
fma-def79.6%
distribute-rgt-neg-out79.6%
add-sqr-sqrt79.4%
sqrt-unprod59.7%
sqr-neg59.7%
sqrt-unprod0.0%
add-sqr-sqrt45.5%
fma-neg45.5%
add-sqr-sqrt0.0%
sqrt-unprod59.7%
sqr-neg59.7%
sqrt-unprod79.4%
add-sqr-sqrt79.6%
Applied egg-rr79.6%
if -9.99999999999999992e-221 < (*.f64 x 1/2) < 2e-282Initial program 99.6%
sub-neg99.6%
associate-+l+99.6%
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.9%
mul-1-neg91.9%
distribute-rgt-neg-in91.9%
sub-neg91.9%
mul-1-neg91.9%
sub-neg91.9%
+-commutative91.9%
distribute-neg-in91.9%
remove-double-neg91.9%
sub-neg91.9%
metadata-eval91.9%
+-commutative91.9%
Simplified91.9%
Taylor expanded in z around 0 67.3%
+-commutative67.3%
distribute-rgt1-in67.4%
Simplified67.4%
Final simplification78.4%
(FPCore (x y z) :precision binary64 (if (<= z 0.00024) (+ (* x 0.5) (+ y (* y (log z)))) (- (* x 0.5) (* y z))))
double code(double x, double y, double z) {
double tmp;
if (z <= 0.00024) {
tmp = (x * 0.5) + (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 <= 0.00024d0) then
tmp = (x * 0.5d0) + (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 <= 0.00024) {
tmp = (x * 0.5) + (y + (y * Math.log(z)));
} else {
tmp = (x * 0.5) - (y * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 0.00024: tmp = (x * 0.5) + (y + (y * math.log(z))) else: tmp = (x * 0.5) - (y * z) return tmp
function code(x, y, z) tmp = 0.0 if (z <= 0.00024) tmp = Float64(Float64(x * 0.5) + 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 <= 0.00024) tmp = (x * 0.5) + (y + (y * log(z))); else tmp = (x * 0.5) - (y * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 0.00024], N[(N[(x * 0.5), $MachinePrecision] + N[(y + N[(y * N[Log[z], $MachinePrecision]), $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.00024:\\
\;\;\;\;x \cdot 0.5 + \left(y + y \cdot \log z\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 0.5 - y \cdot z\\
\end{array}
\end{array}
if z < 2.40000000000000006e-4Initial program 99.8%
Taylor expanded in z around 0 99.7%
*-commutative99.7%
distribute-lft-in99.7%
*-rgt-identity99.7%
Simplified99.7%
if 2.40000000000000006e-4 < z Initial program 100.0%
Taylor expanded in z around inf 98.1%
mul-1-neg98.1%
distribute-rgt-neg-out98.1%
Simplified98.1%
fma-def98.1%
distribute-rgt-neg-out98.1%
add-sqr-sqrt97.8%
sqrt-unprod61.4%
sqr-neg61.4%
sqrt-unprod0.0%
add-sqr-sqrt32.5%
fma-neg32.5%
add-sqr-sqrt0.0%
sqrt-unprod61.4%
sqr-neg61.4%
sqrt-unprod97.8%
add-sqr-sqrt98.1%
Applied egg-rr98.1%
Final simplification98.9%
(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%
fma-def75.4%
distribute-rgt-neg-out75.4%
add-sqr-sqrt75.3%
sqrt-unprod57.0%
sqr-neg57.0%
sqrt-unprod0.0%
add-sqr-sqrt42.1%
fma-neg42.1%
add-sqr-sqrt0.0%
sqrt-unprod57.0%
sqr-neg57.0%
sqrt-unprod75.3%
add-sqr-sqrt75.4%
Applied egg-rr75.4%
Final simplification75.4%
(FPCore (x y z) :precision binary64 (if (<= z 2.5e+29) (* x 0.5) (* y (- z))))
double code(double x, double y, double z) {
double tmp;
if (z <= 2.5e+29) {
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.5d+29) 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.5e+29) {
tmp = x * 0.5;
} else {
tmp = y * -z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 2.5e+29: tmp = x * 0.5 else: tmp = y * -z return tmp
function code(x, y, z) tmp = 0.0 if (z <= 2.5e+29) 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.5e+29) tmp = x * 0.5; else tmp = y * -z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 2.5e+29], N[(x * 0.5), $MachinePrecision], N[(y * (-z)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 2.5 \cdot 10^{+29}:\\
\;\;\;\;x \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(-z\right)\\
\end{array}
\end{array}
if z < 2.5e29Initial 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 inf 52.8%
if 2.5e29 < 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 71.9%
mul-1-neg71.9%
distribute-rgt-neg-in71.9%
sub-neg71.9%
mul-1-neg71.9%
sub-neg71.9%
+-commutative71.9%
distribute-neg-in71.9%
remove-double-neg71.9%
sub-neg71.9%
metadata-eval71.9%
+-commutative71.9%
Simplified71.9%
Taylor expanded in z around inf 71.9%
mul-1-neg71.9%
distribute-rgt-neg-out71.9%
Simplified71.9%
Final simplification61.3%
(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%
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 x around inf 43.1%
Final simplification43.1%
(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 2023221
(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)))))