
(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 (+ (- (log z) z) 1.0) y (* x 0.5)))
double code(double x, double y, double z) {
return fma(((log(z) - z) + 1.0), y, (x * 0.5));
}
function code(x, y, z) return fma(Float64(Float64(log(z) - z) + 1.0), y, Float64(x * 0.5)) end
code[x_, y_, z_] := N[(N[(N[(N[Log[z], $MachinePrecision] - z), $MachinePrecision] + 1.0), $MachinePrecision] * y + N[(x * 0.5), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\left(\log z - z\right) + 1, y, x \cdot 0.5\right)
\end{array}
Initial program 99.9%
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-commutativeN/A
associate-+r-N/A
--lowering--.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
log-lowering-log.f6499.9%
Simplified99.9%
+-commutativeN/A
*-commutativeN/A
fma-defineN/A
fma-lowering-fma.f64N/A
associate--l+N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
log-lowering-log.f64N/A
*-lowering-*.f6499.9%
Applied egg-rr99.9%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* y (+ (log z) 1.0))))
(if (<= z 2.3e-239)
t_0
(if (<= z 4.5e-127)
(* x (- 0.5 (/ (* z y) x)))
(if (<= z 3.8e-48) t_0 (- (* x 0.5) (* z y)))))))
double code(double x, double y, double z) {
double t_0 = y * (log(z) + 1.0);
double tmp;
if (z <= 2.3e-239) {
tmp = t_0;
} else if (z <= 4.5e-127) {
tmp = x * (0.5 - ((z * y) / x));
} else if (z <= 3.8e-48) {
tmp = t_0;
} 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) :: t_0
real(8) :: tmp
t_0 = y * (log(z) + 1.0d0)
if (z <= 2.3d-239) then
tmp = t_0
else if (z <= 4.5d-127) then
tmp = x * (0.5d0 - ((z * y) / x))
else if (z <= 3.8d-48) then
tmp = t_0
else
tmp = (x * 0.5d0) - (z * y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = y * (Math.log(z) + 1.0);
double tmp;
if (z <= 2.3e-239) {
tmp = t_0;
} else if (z <= 4.5e-127) {
tmp = x * (0.5 - ((z * y) / x));
} else if (z <= 3.8e-48) {
tmp = t_0;
} else {
tmp = (x * 0.5) - (z * y);
}
return tmp;
}
def code(x, y, z): t_0 = y * (math.log(z) + 1.0) tmp = 0 if z <= 2.3e-239: tmp = t_0 elif z <= 4.5e-127: tmp = x * (0.5 - ((z * y) / x)) elif z <= 3.8e-48: tmp = t_0 else: tmp = (x * 0.5) - (z * y) return tmp
function code(x, y, z) t_0 = Float64(y * Float64(log(z) + 1.0)) tmp = 0.0 if (z <= 2.3e-239) tmp = t_0; elseif (z <= 4.5e-127) tmp = Float64(x * Float64(0.5 - Float64(Float64(z * y) / x))); elseif (z <= 3.8e-48) tmp = t_0; else tmp = Float64(Float64(x * 0.5) - Float64(z * y)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = y * (log(z) + 1.0); tmp = 0.0; if (z <= 2.3e-239) tmp = t_0; elseif (z <= 4.5e-127) tmp = x * (0.5 - ((z * y) / x)); elseif (z <= 3.8e-48) tmp = t_0; else tmp = (x * 0.5) - (z * y); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(y * N[(N[Log[z], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, 2.3e-239], t$95$0, If[LessEqual[z, 4.5e-127], N[(x * N[(0.5 - N[(N[(z * y), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.8e-48], t$95$0, N[(N[(x * 0.5), $MachinePrecision] - N[(z * y), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y \cdot \left(\log z + 1\right)\\
\mathbf{if}\;z \leq 2.3 \cdot 10^{-239}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 4.5 \cdot 10^{-127}:\\
\;\;\;\;x \cdot \left(0.5 - \frac{z \cdot y}{x}\right)\\
\mathbf{elif}\;z \leq 3.8 \cdot 10^{-48}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;x \cdot 0.5 - z \cdot y\\
\end{array}
\end{array}
if z < 2.2999999999999999e-239 or 4.4999999999999999e-127 < z < 3.80000000000000002e-48Initial program 99.7%
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-commutativeN/A
associate-+r-N/A
--lowering--.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
log-lowering-log.f6499.7%
Simplified99.7%
Taylor expanded in z around 0
*-lowering-*.f64N/A
+-lowering-+.f64N/A
log-lowering-log.f6499.7%
Simplified99.7%
Taylor expanded in x around 0
*-lowering-*.f64N/A
+-lowering-+.f64N/A
log-lowering-log.f6465.2%
Simplified65.2%
if 2.2999999999999999e-239 < z < 4.4999999999999999e-127Initial program 99.9%
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-commutativeN/A
associate-+r-N/A
--lowering--.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
log-lowering-log.f6499.9%
Simplified99.9%
Taylor expanded in z around inf
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
*-lowering-*.f6464.0%
Simplified64.0%
Taylor expanded in x around inf
+-commutativeN/A
mul-1-negN/A
neg-sub0N/A
associate-+l-N/A
neg-sub0N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
distribute-neg-inN/A
metadata-evalN/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f6464.0%
Simplified64.0%
if 3.80000000000000002e-48 < z Initial program 100.0%
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-commutativeN/A
associate-+r-N/A
--lowering--.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
log-lowering-log.f64100.0%
Simplified100.0%
Taylor expanded in z around inf
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
*-lowering-*.f6492.9%
Simplified92.9%
sub0-negN/A
unsub-negN/A
+-lft-identityN/A
flip3-+N/A
sqr-powN/A
pow-prod-downN/A
sqr-negN/A
sub0-negN/A
sub0-negN/A
pow-prod-downN/A
sqr-powN/A
metadata-evalN/A
sub0-negN/A
cube-negN/A
sub-negN/A
metadata-evalN/A
mul0-lftN/A
fmm-defN/A
metadata-evalN/A
mul0-lftN/A
Applied egg-rr92.9%
Final simplification81.6%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- (log z) z)) (t_1 (* y (+ t_0 1.0))))
(if (<= y -2.35e+127)
t_1
(if (<= y 6.8e+117) (+ (* x 0.5) (* t_0 y)) t_1))))
double code(double x, double y, double z) {
double t_0 = log(z) - z;
double t_1 = y * (t_0 + 1.0);
double tmp;
if (y <= -2.35e+127) {
tmp = t_1;
} else if (y <= 6.8e+117) {
tmp = (x * 0.5) + (t_0 * y);
} else {
tmp = t_1;
}
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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = log(z) - z
t_1 = y * (t_0 + 1.0d0)
if (y <= (-2.35d+127)) then
tmp = t_1
else if (y <= 6.8d+117) then
tmp = (x * 0.5d0) + (t_0 * y)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = Math.log(z) - z;
double t_1 = y * (t_0 + 1.0);
double tmp;
if (y <= -2.35e+127) {
tmp = t_1;
} else if (y <= 6.8e+117) {
tmp = (x * 0.5) + (t_0 * y);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = math.log(z) - z t_1 = y * (t_0 + 1.0) tmp = 0 if y <= -2.35e+127: tmp = t_1 elif y <= 6.8e+117: tmp = (x * 0.5) + (t_0 * y) else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(log(z) - z) t_1 = Float64(y * Float64(t_0 + 1.0)) tmp = 0.0 if (y <= -2.35e+127) tmp = t_1; elseif (y <= 6.8e+117) tmp = Float64(Float64(x * 0.5) + Float64(t_0 * y)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = log(z) - z; t_1 = y * (t_0 + 1.0); tmp = 0.0; if (y <= -2.35e+127) tmp = t_1; elseif (y <= 6.8e+117) tmp = (x * 0.5) + (t_0 * y); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Log[z], $MachinePrecision] - z), $MachinePrecision]}, Block[{t$95$1 = N[(y * N[(t$95$0 + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2.35e+127], t$95$1, If[LessEqual[y, 6.8e+117], N[(N[(x * 0.5), $MachinePrecision] + N[(t$95$0 * y), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log z - z\\
t_1 := y \cdot \left(t\_0 + 1\right)\\
\mathbf{if}\;y \leq -2.35 \cdot 10^{+127}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 6.8 \cdot 10^{+117}:\\
\;\;\;\;x \cdot 0.5 + t\_0 \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -2.35000000000000018e127 or 6.8000000000000002e117 < y Initial program 99.9%
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-commutativeN/A
associate-+r-N/A
--lowering--.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
log-lowering-log.f6499.9%
Simplified99.9%
Taylor expanded in x around 0
*-lowering-*.f64N/A
associate--l+N/A
sub-negN/A
mul-1-negN/A
*-lft-identityN/A
metadata-evalN/A
cancel-sign-sub-invN/A
neg-mul-1N/A
--lowering--.f64N/A
mul-1-negN/A
+-commutativeN/A
distribute-neg-inN/A
remove-double-negN/A
sub-negN/A
--lowering--.f64N/A
log-lowering-log.f6490.9%
Simplified90.9%
if -2.35000000000000018e127 < y < 6.8000000000000002e117Initial program 99.9%
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-commutativeN/A
associate-+r-N/A
--lowering--.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
log-lowering-log.f6499.9%
Simplified99.9%
associate--l+N/A
distribute-rgt-inN/A
*-lft-identityN/A
associate-+r+N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
log-lowering-log.f6499.9%
Applied egg-rr99.9%
Taylor expanded in x around inf
*-lowering-*.f6491.1%
Simplified91.1%
Final simplification91.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* y (+ (- (log z) z) 1.0))))
(if (<= y -1.28e+66)
t_0
(if (<= y 6.8e+117) (fma (- 0.0 z) y (* x 0.5)) t_0))))
double code(double x, double y, double z) {
double t_0 = y * ((log(z) - z) + 1.0);
double tmp;
if (y <= -1.28e+66) {
tmp = t_0;
} else if (y <= 6.8e+117) {
tmp = fma((0.0 - z), y, (x * 0.5));
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(y * Float64(Float64(log(z) - z) + 1.0)) tmp = 0.0 if (y <= -1.28e+66) tmp = t_0; elseif (y <= 6.8e+117) tmp = fma(Float64(0.0 - z), y, Float64(x * 0.5)); else tmp = t_0; end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(y * N[(N[(N[Log[z], $MachinePrecision] - z), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.28e+66], t$95$0, If[LessEqual[y, 6.8e+117], N[(N[(0.0 - z), $MachinePrecision] * y + N[(x * 0.5), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y \cdot \left(\left(\log z - z\right) + 1\right)\\
\mathbf{if}\;y \leq -1.28 \cdot 10^{+66}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 6.8 \cdot 10^{+117}:\\
\;\;\;\;\mathsf{fma}\left(0 - z, y, x \cdot 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -1.28000000000000003e66 or 6.8000000000000002e117 < y Initial program 99.9%
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-commutativeN/A
associate-+r-N/A
--lowering--.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
log-lowering-log.f6499.9%
Simplified99.9%
Taylor expanded in x around 0
*-lowering-*.f64N/A
associate--l+N/A
sub-negN/A
mul-1-negN/A
*-lft-identityN/A
metadata-evalN/A
cancel-sign-sub-invN/A
neg-mul-1N/A
--lowering--.f64N/A
mul-1-negN/A
+-commutativeN/A
distribute-neg-inN/A
remove-double-negN/A
sub-negN/A
--lowering--.f64N/A
log-lowering-log.f6489.8%
Simplified89.8%
if -1.28000000000000003e66 < y < 6.8000000000000002e117Initial program 99.9%
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-commutativeN/A
associate-+r-N/A
--lowering--.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
log-lowering-log.f6499.9%
Simplified99.9%
Taylor expanded in z around inf
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
*-lowering-*.f6488.6%
Simplified88.6%
+-commutativeN/A
sub0-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
fma-defineN/A
fma-lowering-fma.f64N/A
neg-sub0N/A
--lowering--.f64N/A
*-lowering-*.f6488.6%
Applied egg-rr88.6%
Final simplification89.1%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* y (+ (- (log z) z) 1.0)))) (if (<= y -3.4e+65) t_0 (if (<= y 6.8e+117) (- (* x 0.5) (* z y)) t_0))))
double code(double x, double y, double z) {
double t_0 = y * ((log(z) - z) + 1.0);
double tmp;
if (y <= -3.4e+65) {
tmp = t_0;
} else if (y <= 6.8e+117) {
tmp = (x * 0.5) - (z * y);
} else {
tmp = t_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) :: t_0
real(8) :: tmp
t_0 = y * ((log(z) - z) + 1.0d0)
if (y <= (-3.4d+65)) then
tmp = t_0
else if (y <= 6.8d+117) then
tmp = (x * 0.5d0) - (z * y)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = y * ((Math.log(z) - z) + 1.0);
double tmp;
if (y <= -3.4e+65) {
tmp = t_0;
} else if (y <= 6.8e+117) {
tmp = (x * 0.5) - (z * y);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = y * ((math.log(z) - z) + 1.0) tmp = 0 if y <= -3.4e+65: tmp = t_0 elif y <= 6.8e+117: tmp = (x * 0.5) - (z * y) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(y * Float64(Float64(log(z) - z) + 1.0)) tmp = 0.0 if (y <= -3.4e+65) tmp = t_0; elseif (y <= 6.8e+117) tmp = Float64(Float64(x * 0.5) - Float64(z * y)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = y * ((log(z) - z) + 1.0); tmp = 0.0; if (y <= -3.4e+65) tmp = t_0; elseif (y <= 6.8e+117) tmp = (x * 0.5) - (z * y); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(y * N[(N[(N[Log[z], $MachinePrecision] - z), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -3.4e+65], t$95$0, If[LessEqual[y, 6.8e+117], N[(N[(x * 0.5), $MachinePrecision] - N[(z * y), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y \cdot \left(\left(\log z - z\right) + 1\right)\\
\mathbf{if}\;y \leq -3.4 \cdot 10^{+65}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 6.8 \cdot 10^{+117}:\\
\;\;\;\;x \cdot 0.5 - z \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -3.3999999999999999e65 or 6.8000000000000002e117 < y Initial program 99.9%
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-commutativeN/A
associate-+r-N/A
--lowering--.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
log-lowering-log.f6499.9%
Simplified99.9%
Taylor expanded in x around 0
*-lowering-*.f64N/A
associate--l+N/A
sub-negN/A
mul-1-negN/A
*-lft-identityN/A
metadata-evalN/A
cancel-sign-sub-invN/A
neg-mul-1N/A
--lowering--.f64N/A
mul-1-negN/A
+-commutativeN/A
distribute-neg-inN/A
remove-double-negN/A
sub-negN/A
--lowering--.f64N/A
log-lowering-log.f6489.8%
Simplified89.8%
if -3.3999999999999999e65 < y < 6.8000000000000002e117Initial program 99.9%
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-commutativeN/A
associate-+r-N/A
--lowering--.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
log-lowering-log.f6499.9%
Simplified99.9%
Taylor expanded in z around inf
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
*-lowering-*.f6488.6%
Simplified88.6%
sub0-negN/A
unsub-negN/A
+-lft-identityN/A
flip3-+N/A
sqr-powN/A
pow-prod-downN/A
sqr-negN/A
sub0-negN/A
sub0-negN/A
pow-prod-downN/A
sqr-powN/A
metadata-evalN/A
sub0-negN/A
cube-negN/A
sub-negN/A
metadata-evalN/A
mul0-lftN/A
fmm-defN/A
metadata-evalN/A
mul0-lftN/A
Applied egg-rr88.6%
Final simplification89.1%
(FPCore (x y z) :precision binary64 (if (<= z 0.042) (+ (* x 0.5) (* y (+ (log z) 1.0))) (+ (* x 0.5) (* (- (log z) z) y))))
double code(double x, double y, double z) {
double tmp;
if (z <= 0.042) {
tmp = (x * 0.5) + (y * (log(z) + 1.0));
} else {
tmp = (x * 0.5) + ((log(z) - 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.042d0) then
tmp = (x * 0.5d0) + (y * (log(z) + 1.0d0))
else
tmp = (x * 0.5d0) + ((log(z) - z) * y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= 0.042) {
tmp = (x * 0.5) + (y * (Math.log(z) + 1.0));
} else {
tmp = (x * 0.5) + ((Math.log(z) - z) * y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 0.042: tmp = (x * 0.5) + (y * (math.log(z) + 1.0)) else: tmp = (x * 0.5) + ((math.log(z) - z) * y) return tmp
function code(x, y, z) tmp = 0.0 if (z <= 0.042) tmp = Float64(Float64(x * 0.5) + Float64(y * Float64(log(z) + 1.0))); else tmp = Float64(Float64(x * 0.5) + Float64(Float64(log(z) - z) * y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= 0.042) tmp = (x * 0.5) + (y * (log(z) + 1.0)); else tmp = (x * 0.5) + ((log(z) - z) * y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 0.042], N[(N[(x * 0.5), $MachinePrecision] + N[(y * N[(N[Log[z], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * 0.5), $MachinePrecision] + N[(N[(N[Log[z], $MachinePrecision] - z), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 0.042:\\
\;\;\;\;x \cdot 0.5 + y \cdot \left(\log z + 1\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 0.5 + \left(\log z - z\right) \cdot y\\
\end{array}
\end{array}
if z < 0.0420000000000000026Initial program 99.8%
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-commutativeN/A
associate-+r-N/A
--lowering--.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
log-lowering-log.f6499.8%
Simplified99.8%
Taylor expanded in z around 0
*-lowering-*.f64N/A
+-lowering-+.f64N/A
log-lowering-log.f6499.3%
Simplified99.3%
if 0.0420000000000000026 < z Initial program 100.0%
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-commutativeN/A
associate-+r-N/A
--lowering--.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
log-lowering-log.f64100.0%
Simplified100.0%
associate--l+N/A
distribute-rgt-inN/A
*-lft-identityN/A
associate-+r+N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
log-lowering-log.f64100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf
*-lowering-*.f6498.8%
Simplified98.8%
Final simplification99.0%
(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 (<= z 9e+17) (* x 0.5) (- 0.0 (* z y))))
double code(double x, double y, double z) {
double tmp;
if (z <= 9e+17) {
tmp = x * 0.5;
} else {
tmp = 0.0 - (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 <= 9d+17) then
tmp = x * 0.5d0
else
tmp = 0.0d0 - (z * y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= 9e+17) {
tmp = x * 0.5;
} else {
tmp = 0.0 - (z * y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 9e+17: tmp = x * 0.5 else: tmp = 0.0 - (z * y) return tmp
function code(x, y, z) tmp = 0.0 if (z <= 9e+17) tmp = Float64(x * 0.5); else tmp = Float64(0.0 - Float64(z * y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= 9e+17) tmp = x * 0.5; else tmp = 0.0 - (z * y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 9e+17], N[(x * 0.5), $MachinePrecision], N[(0.0 - N[(z * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 9 \cdot 10^{+17}:\\
\;\;\;\;x \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;0 - z \cdot y\\
\end{array}
\end{array}
if z < 9e17Initial program 99.8%
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-commutativeN/A
associate-+r-N/A
--lowering--.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
log-lowering-log.f6499.8%
Simplified99.8%
Taylor expanded in x around inf
*-lowering-*.f6451.9%
Simplified51.9%
if 9e17 < z Initial program 100.0%
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-commutativeN/A
associate-+r-N/A
--lowering--.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
log-lowering-log.f64100.0%
Simplified100.0%
Taylor expanded in z around inf
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
*-lowering-*.f6474.4%
Simplified74.4%
sub0-negN/A
*-commutativeN/A
neg-lowering-neg.f64N/A
*-commutativeN/A
*-lowering-*.f6474.4%
Applied egg-rr74.4%
Final simplification62.6%
(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%
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-commutativeN/A
associate-+r-N/A
--lowering--.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
log-lowering-log.f6499.9%
Simplified99.9%
Taylor expanded in z around inf
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
*-lowering-*.f6475.8%
Simplified75.8%
sub0-negN/A
unsub-negN/A
+-lft-identityN/A
flip3-+N/A
sqr-powN/A
pow-prod-downN/A
sqr-negN/A
sub0-negN/A
sub0-negN/A
pow-prod-downN/A
sqr-powN/A
metadata-evalN/A
sub0-negN/A
cube-negN/A
sub-negN/A
metadata-evalN/A
mul0-lftN/A
fmm-defN/A
metadata-evalN/A
mul0-lftN/A
Applied egg-rr75.8%
(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%
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-commutativeN/A
associate-+r-N/A
--lowering--.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
log-lowering-log.f6499.9%
Simplified99.9%
Taylor expanded in x around inf
*-lowering-*.f6439.6%
Simplified39.6%
Final simplification39.6%
(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 2024150
(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)))))