
(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 y (+ (- 1.0 z) (log z)) (* x 0.5)))
double code(double x, double y, double z) {
return fma(y, ((1.0 - z) + log(z)), (x * 0.5));
}
function code(x, y, z) return fma(y, Float64(Float64(1.0 - z) + log(z)), Float64(x * 0.5)) end
code[x_, y_, z_] := N[(y * N[(N[(1.0 - z), $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision] + N[(x * 0.5), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y, \left(1 - z\right) + \log z, x \cdot 0.5\right)
\end{array}
Initial program 99.8%
+-commutative99.8%
fma-define99.9%
Simplified99.9%
(FPCore (x y z) :precision binary64 (if (or (<= y -1.3e+41) (not (<= y 8.2e+52))) (* y (+ (- 1.0 z) (log z))) (- (* x 0.5) (* y z))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.3e+41) || !(y <= 8.2e+52)) {
tmp = y * ((1.0 - z) + 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 ((y <= (-1.3d+41)) .or. (.not. (y <= 8.2d+52))) then
tmp = y * ((1.0d0 - z) + 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 ((y <= -1.3e+41) || !(y <= 8.2e+52)) {
tmp = y * ((1.0 - z) + Math.log(z));
} else {
tmp = (x * 0.5) - (y * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1.3e+41) or not (y <= 8.2e+52): tmp = y * ((1.0 - z) + math.log(z)) else: tmp = (x * 0.5) - (y * z) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1.3e+41) || !(y <= 8.2e+52)) tmp = Float64(y * Float64(Float64(1.0 - z) + 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 ((y <= -1.3e+41) || ~((y <= 8.2e+52))) tmp = y * ((1.0 - z) + log(z)); else tmp = (x * 0.5) - (y * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.3e+41], N[Not[LessEqual[y, 8.2e+52]], $MachinePrecision]], N[(y * N[(N[(1.0 - z), $MachinePrecision] + N[Log[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * 0.5), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.3 \cdot 10^{+41} \lor \neg \left(y \leq 8.2 \cdot 10^{+52}\right):\\
\;\;\;\;y \cdot \left(\left(1 - z\right) + \log z\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 0.5 - y \cdot z\\
\end{array}
\end{array}
if y < -1.3e41 or 8.1999999999999999e52 < y Initial program 99.7%
distribute-lft-in99.7%
Applied egg-rr99.7%
Taylor expanded in x around inf 69.5%
Taylor expanded in x around 0 87.1%
distribute-lft-out87.1%
Simplified87.1%
if -1.3e41 < y < 8.1999999999999999e52Initial program 99.9%
Taylor expanded in z around inf 89.2%
associate-*r*89.2%
mul-1-neg89.2%
Simplified89.2%
fma-define89.2%
distribute-lft-neg-out89.2%
add-sqr-sqrt42.4%
sqrt-unprod74.7%
sqr-neg74.7%
sqrt-unprod33.6%
add-sqr-sqrt66.4%
fma-neg66.4%
add-sqr-sqrt33.6%
sqrt-unprod74.7%
sqr-neg74.7%
sqrt-unprod42.4%
add-sqr-sqrt89.2%
Applied egg-rr89.2%
Final simplification88.3%
(FPCore (x y z) :precision binary64 (if (or (<= y -7e+41) (not (<= y 1.46e+162))) (* y (+ 1.0 (log z))) (- (* x 0.5) (* y z))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -7e+41) || !(y <= 1.46e+162)) {
tmp = y * (1.0 + 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 ((y <= (-7d+41)) .or. (.not. (y <= 1.46d+162))) then
tmp = y * (1.0d0 + 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 ((y <= -7e+41) || !(y <= 1.46e+162)) {
tmp = y * (1.0 + Math.log(z));
} else {
tmp = (x * 0.5) - (y * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -7e+41) or not (y <= 1.46e+162): tmp = y * (1.0 + math.log(z)) else: tmp = (x * 0.5) - (y * z) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -7e+41) || !(y <= 1.46e+162)) tmp = Float64(y * Float64(1.0 + 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 ((y <= -7e+41) || ~((y <= 1.46e+162))) tmp = y * (1.0 + log(z)); else tmp = (x * 0.5) - (y * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -7e+41], N[Not[LessEqual[y, 1.46e+162]], $MachinePrecision]], N[(y * N[(1.0 + N[Log[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * 0.5), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7 \cdot 10^{+41} \lor \neg \left(y \leq 1.46 \cdot 10^{+162}\right):\\
\;\;\;\;y \cdot \left(1 + \log z\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 0.5 - y \cdot z\\
\end{array}
\end{array}
if y < -6.9999999999999998e41 or 1.4599999999999999e162 < y Initial program 99.7%
Taylor expanded in z around 0 67.9%
Taylor expanded in x around 0 57.8%
if -6.9999999999999998e41 < y < 1.4599999999999999e162Initial program 99.9%
Taylor expanded in z around inf 86.7%
associate-*r*86.7%
mul-1-neg86.7%
Simplified86.7%
fma-define86.7%
distribute-lft-neg-out86.7%
add-sqr-sqrt47.2%
sqrt-unprod73.9%
sqr-neg73.9%
sqrt-unprod28.4%
add-sqr-sqrt58.9%
fma-neg58.9%
add-sqr-sqrt28.4%
sqrt-unprod73.9%
sqr-neg73.9%
sqrt-unprod47.2%
add-sqr-sqrt86.7%
Applied egg-rr86.7%
Final simplification77.5%
(FPCore (x y z) :precision binary64 (if (<= y -1.15e+42) (* y (+ 1.0 (log z))) (if (<= y 1.32e+162) (- (* x 0.5) (* y z)) (+ y (* y (log z))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.15e+42) {
tmp = y * (1.0 + log(z));
} else if (y <= 1.32e+162) {
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 (y <= (-1.15d+42)) then
tmp = y * (1.0d0 + log(z))
else if (y <= 1.32d+162) 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 (y <= -1.15e+42) {
tmp = y * (1.0 + Math.log(z));
} else if (y <= 1.32e+162) {
tmp = (x * 0.5) - (y * z);
} else {
tmp = y + (y * Math.log(z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.15e+42: tmp = y * (1.0 + math.log(z)) elif y <= 1.32e+162: tmp = (x * 0.5) - (y * z) else: tmp = y + (y * math.log(z)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.15e+42) tmp = Float64(y * Float64(1.0 + log(z))); elseif (y <= 1.32e+162) 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 (y <= -1.15e+42) tmp = y * (1.0 + log(z)); elseif (y <= 1.32e+162) tmp = (x * 0.5) - (y * z); else tmp = y + (y * log(z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.15e+42], N[(y * N[(1.0 + N[Log[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.32e+162], 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}\;y \leq -1.15 \cdot 10^{+42}:\\
\;\;\;\;y \cdot \left(1 + \log z\right)\\
\mathbf{elif}\;y \leq 1.32 \cdot 10^{+162}:\\
\;\;\;\;x \cdot 0.5 - y \cdot z\\
\mathbf{else}:\\
\;\;\;\;y + y \cdot \log z\\
\end{array}
\end{array}
if y < -1.15e42Initial program 99.7%
Taylor expanded in z around 0 73.0%
Taylor expanded in x around 0 60.3%
if -1.15e42 < y < 1.31999999999999999e162Initial program 99.9%
Taylor expanded in z around inf 86.7%
associate-*r*86.7%
mul-1-neg86.7%
Simplified86.7%
fma-define86.7%
distribute-lft-neg-out86.7%
add-sqr-sqrt47.2%
sqrt-unprod73.9%
sqr-neg73.9%
sqrt-unprod28.4%
add-sqr-sqrt58.9%
fma-neg58.9%
add-sqr-sqrt28.4%
sqrt-unprod73.9%
sqr-neg73.9%
sqrt-unprod47.2%
add-sqr-sqrt86.7%
Applied egg-rr86.7%
if 1.31999999999999999e162 < y Initial program 99.7%
Taylor expanded in z around 0 61.6%
Taylor expanded in x around 0 54.9%
+-commutative54.9%
distribute-lft-in55.0%
*-rgt-identity55.0%
Applied egg-rr55.0%
Final simplification77.5%
(FPCore (x y z) :precision binary64 (if (<= z 0.0031) (+ (* x 0.5) (* y (+ 1.0 (log z)))) (- (* x 0.5) (* y z))))
double code(double x, double y, double z) {
double tmp;
if (z <= 0.0031) {
tmp = (x * 0.5) + (y * (1.0 + 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.0031d0) then
tmp = (x * 0.5d0) + (y * (1.0d0 + 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.0031) {
tmp = (x * 0.5) + (y * (1.0 + Math.log(z)));
} else {
tmp = (x * 0.5) - (y * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 0.0031: tmp = (x * 0.5) + (y * (1.0 + math.log(z))) else: tmp = (x * 0.5) - (y * z) return tmp
function code(x, y, z) tmp = 0.0 if (z <= 0.0031) tmp = Float64(Float64(x * 0.5) + Float64(y * Float64(1.0 + 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.0031) tmp = (x * 0.5) + (y * (1.0 + log(z))); else tmp = (x * 0.5) - (y * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 0.0031], N[(N[(x * 0.5), $MachinePrecision] + N[(y * N[(1.0 + 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.0031:\\
\;\;\;\;x \cdot 0.5 + y \cdot \left(1 + \log z\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 0.5 - y \cdot z\\
\end{array}
\end{array}
if z < 0.00309999999999999989Initial program 99.7%
Taylor expanded in z around 0 99.0%
if 0.00309999999999999989 < z Initial program 100.0%
Taylor expanded in z around inf 98.8%
associate-*r*98.8%
mul-1-neg98.8%
Simplified98.8%
fma-define98.8%
distribute-lft-neg-out98.8%
add-sqr-sqrt54.5%
sqrt-unprod67.7%
sqr-neg67.7%
sqrt-unprod16.0%
add-sqr-sqrt33.1%
fma-neg33.1%
add-sqr-sqrt16.0%
sqrt-unprod67.7%
sqr-neg67.7%
sqrt-unprod54.5%
add-sqr-sqrt98.8%
Applied egg-rr98.8%
(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.8%
(FPCore (x y z) :precision binary64 (if (<= z 1.8e+111) (* x 0.5) (* y (- 1.0 z))))
double code(double x, double y, double z) {
double tmp;
if (z <= 1.8e+111) {
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.8d+111) 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.8e+111) {
tmp = x * 0.5;
} else {
tmp = y * (1.0 - z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 1.8e+111: tmp = x * 0.5 else: tmp = y * (1.0 - z) return tmp
function code(x, y, z) tmp = 0.0 if (z <= 1.8e+111) 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.8e+111) tmp = x * 0.5; else tmp = y * (1.0 - z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 1.8e+111], N[(x * 0.5), $MachinePrecision], N[(y * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1.8 \cdot 10^{+111}:\\
\;\;\;\;x \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(1 - z\right)\\
\end{array}
\end{array}
if z < 1.8000000000000001e111Initial program 99.8%
Taylor expanded in x around inf 52.4%
if 1.8000000000000001e111 < z Initial program 100.0%
Taylor expanded in x around -inf 90.0%
mul-1-neg90.0%
distribute-rgt-neg-in90.0%
sub-neg90.0%
mul-1-neg90.0%
*-commutative90.0%
+-commutative90.0%
associate--l+90.0%
+-commutative90.0%
associate-/l*89.8%
distribute-lft-neg-in89.8%
associate-+l-89.8%
sub-neg89.8%
distribute-neg-in89.8%
metadata-eval89.8%
remove-double-neg89.8%
Simplified89.8%
Taylor expanded in z around inf 89.8%
Taylor expanded in x around 0 82.9%
mul-1-neg82.9%
sub-neg82.9%
metadata-eval82.9%
distribute-rgt-neg-in82.9%
+-commutative82.9%
distribute-neg-in82.9%
metadata-eval82.9%
sub-neg82.9%
Simplified82.9%
Final simplification60.4%
(FPCore (x y z) :precision binary64 (if (<= z 1.8e+111) (* x 0.5) (* y (- z))))
double code(double x, double y, double z) {
double tmp;
if (z <= 1.8e+111) {
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 <= 1.8d+111) 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 <= 1.8e+111) {
tmp = x * 0.5;
} else {
tmp = y * -z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 1.8e+111: tmp = x * 0.5 else: tmp = y * -z return tmp
function code(x, y, z) tmp = 0.0 if (z <= 1.8e+111) 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 <= 1.8e+111) tmp = x * 0.5; else tmp = y * -z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 1.8e+111], N[(x * 0.5), $MachinePrecision], N[(y * (-z)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1.8 \cdot 10^{+111}:\\
\;\;\;\;x \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(-z\right)\\
\end{array}
\end{array}
if z < 1.8000000000000001e111Initial program 99.8%
Taylor expanded in x around inf 52.4%
if 1.8000000000000001e111 < z Initial program 100.0%
distribute-lft-in100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf 79.4%
Taylor expanded in z around inf 82.9%
neg-mul-182.9%
distribute-rgt-neg-in82.9%
Simplified82.9%
Final simplification60.4%
(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.8%
Taylor expanded in z around inf 71.9%
associate-*r*71.9%
mul-1-neg71.9%
Simplified71.9%
fma-define71.9%
distribute-lft-neg-out71.9%
add-sqr-sqrt37.8%
sqrt-unprod57.3%
sqr-neg57.3%
sqrt-unprod21.6%
add-sqr-sqrt42.9%
fma-neg42.9%
add-sqr-sqrt21.6%
sqrt-unprod57.3%
sqr-neg57.3%
sqrt-unprod37.8%
add-sqr-sqrt71.9%
Applied egg-rr71.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.8%
Taylor expanded in x around inf 43.8%
Final simplification43.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 2024116
(FPCore (x y z)
:name "System.Random.MWC.Distributions:gamma from mwc-random-0.13.3.2"
:precision binary64
:alt
(! :herbie-platform default (- (+ y (* 1/2 x)) (* y (- z (log z)))))
(+ (* x 0.5) (* y (+ (- 1.0 z) (log z)))))