
(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 11 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 (- (+ (log z) 1.0) z))))
double code(double x, double y, double z) {
return (x * 0.5) + (y * ((log(z) + 1.0) - 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 * ((log(z) + 1.0d0) - z))
end function
public static double code(double x, double y, double z) {
return (x * 0.5) + (y * ((Math.log(z) + 1.0) - z));
}
def code(x, y, z): return (x * 0.5) + (y * ((math.log(z) + 1.0) - z))
function code(x, y, z) return Float64(Float64(x * 0.5) + Float64(y * Float64(Float64(log(z) + 1.0) - z))) end
function tmp = code(x, y, z) tmp = (x * 0.5) + (y * ((log(z) + 1.0) - z)); end
code[x_, y_, z_] := N[(N[(x * 0.5), $MachinePrecision] + N[(y * N[(N[(N[Log[z], $MachinePrecision] + 1.0), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot 0.5 + y \cdot \left(\left(\log z + 1\right) - z\right)
\end{array}
Initial program 99.9%
lift--.f64N/A
lift-log.f64N/A
+-commutativeN/A
lift--.f64N/A
associate-+r-N/A
lower--.f64N/A
lower-+.f6499.9
Applied egg-rr99.9%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* y (+ (log z) (- 1.0 z)))) (t_1 (* y (- z)))) (if (<= t_0 -1e+144) t_1 (if (<= t_0 1e+34) (* x 0.5) t_1))))
double code(double x, double y, double z) {
double t_0 = y * (log(z) + (1.0 - z));
double t_1 = y * -z;
double tmp;
if (t_0 <= -1e+144) {
tmp = t_1;
} else if (t_0 <= 1e+34) {
tmp = x * 0.5;
} 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 = y * (log(z) + (1.0d0 - z))
t_1 = y * -z
if (t_0 <= (-1d+144)) then
tmp = t_1
else if (t_0 <= 1d+34) then
tmp = x * 0.5d0
else
tmp = t_1
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 - z));
double t_1 = y * -z;
double tmp;
if (t_0 <= -1e+144) {
tmp = t_1;
} else if (t_0 <= 1e+34) {
tmp = x * 0.5;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = y * (math.log(z) + (1.0 - z)) t_1 = y * -z tmp = 0 if t_0 <= -1e+144: tmp = t_1 elif t_0 <= 1e+34: tmp = x * 0.5 else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(y * Float64(log(z) + Float64(1.0 - z))) t_1 = Float64(y * Float64(-z)) tmp = 0.0 if (t_0 <= -1e+144) tmp = t_1; elseif (t_0 <= 1e+34) tmp = Float64(x * 0.5); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = y * (log(z) + (1.0 - z)); t_1 = y * -z; tmp = 0.0; if (t_0 <= -1e+144) tmp = t_1; elseif (t_0 <= 1e+34) tmp = x * 0.5; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(y * N[(N[Log[z], $MachinePrecision] + N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(y * (-z)), $MachinePrecision]}, If[LessEqual[t$95$0, -1e+144], t$95$1, If[LessEqual[t$95$0, 1e+34], N[(x * 0.5), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y \cdot \left(\log z + \left(1 - z\right)\right)\\
t_1 := y \cdot \left(-z\right)\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{+144}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 10^{+34}:\\
\;\;\;\;x \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 y (+.f64 (-.f64 #s(literal 1 binary64) z) (log.f64 z))) < -1.00000000000000002e144 or 9.99999999999999946e33 < (*.f64 y (+.f64 (-.f64 #s(literal 1 binary64) z) (log.f64 z))) Initial program 99.8%
Taylor expanded in z around inf
mul-1-negN/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
lower-neg.f6453.6
Simplified53.6%
if -1.00000000000000002e144 < (*.f64 y (+.f64 (-.f64 #s(literal 1 binary64) z) (log.f64 z))) < 9.99999999999999946e33Initial program 99.9%
Taylor expanded in x around inf
lower-*.f6471.3
Simplified71.3%
Final simplification62.5%
(FPCore (x y z) :precision binary64 (if (<= (* x 0.5) -5e-143) (fma x 0.5 (* y (- z))) (if (<= (* x 0.5) 1e-76) (fma y (- (log z) z) y) (fma (- z) y (* x 0.5)))))
double code(double x, double y, double z) {
double tmp;
if ((x * 0.5) <= -5e-143) {
tmp = fma(x, 0.5, (y * -z));
} else if ((x * 0.5) <= 1e-76) {
tmp = fma(y, (log(z) - z), y);
} else {
tmp = fma(-z, y, (x * 0.5));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (Float64(x * 0.5) <= -5e-143) tmp = fma(x, 0.5, Float64(y * Float64(-z))); elseif (Float64(x * 0.5) <= 1e-76) tmp = fma(y, Float64(log(z) - z), y); else tmp = fma(Float64(-z), y, Float64(x * 0.5)); end return tmp end
code[x_, y_, z_] := If[LessEqual[N[(x * 0.5), $MachinePrecision], -5e-143], N[(x * 0.5 + N[(y * (-z)), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * 0.5), $MachinePrecision], 1e-76], N[(y * N[(N[Log[z], $MachinePrecision] - z), $MachinePrecision] + y), $MachinePrecision], N[((-z) * y + N[(x * 0.5), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot 0.5 \leq -5 \cdot 10^{-143}:\\
\;\;\;\;\mathsf{fma}\left(x, 0.5, y \cdot \left(-z\right)\right)\\
\mathbf{elif}\;x \cdot 0.5 \leq 10^{-76}:\\
\;\;\;\;\mathsf{fma}\left(y, \log z - z, y\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-z, y, x \cdot 0.5\right)\\
\end{array}
\end{array}
if (*.f64 x #s(literal 1/2 binary64)) < -5.0000000000000002e-143Initial program 100.0%
Taylor expanded in z around inf
mul-1-negN/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
lower-neg.f6486.3
Simplified86.3%
lift-neg.f64N/A
lift-*.f64N/A
lower-fma.f6486.3
lift-*.f64N/A
lift-neg.f64N/A
distribute-rgt-neg-outN/A
lower-neg.f64N/A
lower-*.f6486.3
Applied egg-rr86.3%
if -5.0000000000000002e-143 < (*.f64 x #s(literal 1/2 binary64)) < 9.99999999999999927e-77Initial program 99.8%
Taylor expanded in x around 0
sub-negN/A
associate-+r+N/A
mul-1-negN/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
mul-1-negN/A
sub-negN/A
lower--.f64N/A
lower-log.f6494.7
Simplified94.7%
if 9.99999999999999927e-77 < (*.f64 x #s(literal 1/2 binary64)) Initial program 99.9%
Taylor expanded in z around inf
mul-1-negN/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
lower-neg.f6487.9
Simplified87.9%
lift-*.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6487.9
Applied egg-rr87.9%
Final simplification89.5%
(FPCore (x y z) :precision binary64 (if (<= y -3.4e+209) (fma y (log z) y) (if (<= y 4.4e+250) (fma (- z) y (* x 0.5)) (+ y (* y (log z))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -3.4e+209) {
tmp = fma(y, log(z), y);
} else if (y <= 4.4e+250) {
tmp = fma(-z, y, (x * 0.5));
} else {
tmp = y + (y * log(z));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (y <= -3.4e+209) tmp = fma(y, log(z), y); elseif (y <= 4.4e+250) tmp = fma(Float64(-z), y, Float64(x * 0.5)); else tmp = Float64(y + Float64(y * log(z))); end return tmp end
code[x_, y_, z_] := If[LessEqual[y, -3.4e+209], N[(y * N[Log[z], $MachinePrecision] + y), $MachinePrecision], If[LessEqual[y, 4.4e+250], N[((-z) * y + N[(x * 0.5), $MachinePrecision]), $MachinePrecision], N[(y + N[(y * N[Log[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.4 \cdot 10^{+209}:\\
\;\;\;\;\mathsf{fma}\left(y, \log z, y\right)\\
\mathbf{elif}\;y \leq 4.4 \cdot 10^{+250}:\\
\;\;\;\;\mathsf{fma}\left(-z, y, x \cdot 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;y + y \cdot \log z\\
\end{array}
\end{array}
if y < -3.3999999999999997e209Initial program 99.8%
Taylor expanded in x around 0
sub-negN/A
associate-+r+N/A
mul-1-negN/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
mul-1-negN/A
sub-negN/A
lower--.f64N/A
lower-log.f6494.8
Simplified94.8%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f64N/A
lower-log.f6469.8
Simplified69.8%
if -3.3999999999999997e209 < y < 4.40000000000000029e250Initial program 99.9%
Taylor expanded in z around inf
mul-1-negN/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
lower-neg.f6482.6
Simplified82.6%
lift-*.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6482.6
Applied egg-rr82.6%
if 4.40000000000000029e250 < y Initial program 99.6%
Taylor expanded in x around 0
sub-negN/A
associate-+r+N/A
mul-1-negN/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
mul-1-negN/A
sub-negN/A
lower--.f64N/A
lower-log.f6499.6
Simplified99.6%
lift-log.f64N/A
lift--.f64N/A
lower-+.f64N/A
lower-*.f6499.9
Applied egg-rr99.9%
Taylor expanded in z around 0
lower-log.f6472.6
Simplified72.6%
Final simplification81.2%
(FPCore (x y z) :precision binary64 (let* ((t_0 (fma y (log z) y))) (if (<= y -3.4e+209) t_0 (if (<= y 4.4e+250) (fma (- z) y (* x 0.5)) t_0))))
double code(double x, double y, double z) {
double t_0 = fma(y, log(z), y);
double tmp;
if (y <= -3.4e+209) {
tmp = t_0;
} else if (y <= 4.4e+250) {
tmp = fma(-z, y, (x * 0.5));
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = fma(y, log(z), y) tmp = 0.0 if (y <= -3.4e+209) tmp = t_0; elseif (y <= 4.4e+250) tmp = fma(Float64(-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[Log[z], $MachinePrecision] + y), $MachinePrecision]}, If[LessEqual[y, -3.4e+209], t$95$0, If[LessEqual[y, 4.4e+250], N[((-z) * y + N[(x * 0.5), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(y, \log z, y\right)\\
\mathbf{if}\;y \leq -3.4 \cdot 10^{+209}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 4.4 \cdot 10^{+250}:\\
\;\;\;\;\mathsf{fma}\left(-z, y, x \cdot 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -3.3999999999999997e209 or 4.40000000000000029e250 < y Initial program 99.7%
Taylor expanded in x around 0
sub-negN/A
associate-+r+N/A
mul-1-negN/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
mul-1-negN/A
sub-negN/A
lower--.f64N/A
lower-log.f6496.5
Simplified96.5%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f64N/A
lower-log.f6470.7
Simplified70.7%
if -3.3999999999999997e209 < y < 4.40000000000000029e250Initial program 99.9%
Taylor expanded in z around inf
mul-1-negN/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
lower-neg.f6482.6
Simplified82.6%
lift-*.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6482.6
Applied egg-rr82.6%
(FPCore (x y z) :precision binary64 (if (<= z 0.28) (fma 0.5 x (fma y (log z) y)) (fma (- z) y (* x 0.5))))
double code(double x, double y, double z) {
double tmp;
if (z <= 0.28) {
tmp = fma(0.5, x, fma(y, log(z), y));
} else {
tmp = fma(-z, y, (x * 0.5));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (z <= 0.28) tmp = fma(0.5, x, fma(y, log(z), y)); else tmp = fma(Float64(-z), y, Float64(x * 0.5)); end return tmp end
code[x_, y_, z_] := If[LessEqual[z, 0.28], N[(0.5 * x + N[(y * N[Log[z], $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision], N[((-z) * y + N[(x * 0.5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 0.28:\\
\;\;\;\;\mathsf{fma}\left(0.5, x, \mathsf{fma}\left(y, \log z, y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-z, y, x \cdot 0.5\right)\\
\end{array}
\end{array}
if z < 0.28000000000000003Initial program 99.8%
Taylor expanded in x around 0
sub-negN/A
associate-+r+N/A
mul-1-negN/A
distribute-lft-inN/A
*-rgt-identityN/A
associate-+r+N/A
+-commutativeN/A
lower-fma.f64N/A
mul-1-negN/A
sub-negN/A
lower--.f64N/A
lower-log.f64N/A
lower-fma.f6499.8
Simplified99.8%
lift-log.f64N/A
lift--.f64N/A
lift-*.f64N/A
associate-+r+N/A
lower-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-fma.f6499.7
Applied egg-rr99.7%
Taylor expanded in z around 0
+-commutativeN/A
associate-+l+N/A
*-rgt-identityN/A
distribute-lft-inN/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-log.f6499.2
Simplified99.2%
if 0.28000000000000003 < z Initial program 100.0%
Taylor expanded in z around inf
mul-1-negN/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
lower-neg.f6499.3
Simplified99.3%
lift-*.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6499.3
Applied egg-rr99.3%
(FPCore (x y z) :precision binary64 (fma (+ (log z) (- 1.0 z)) y (* x 0.5)))
double code(double x, double y, double z) {
return fma((log(z) + (1.0 - z)), y, (x * 0.5));
}
function code(x, y, z) return fma(Float64(log(z) + Float64(1.0 - z)), y, Float64(x * 0.5)) end
code[x_, y_, z_] := N[(N[(N[Log[z], $MachinePrecision] + N[(1.0 - z), $MachinePrecision]), $MachinePrecision] * y + N[(x * 0.5), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\log z + \left(1 - z\right), y, x \cdot 0.5\right)
\end{array}
Initial program 99.9%
lift-*.f64N/A
lift--.f64N/A
lift-log.f64N/A
lift-+.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6499.9
Applied egg-rr99.9%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (fma y (- (log z) z) (fma 0.5 x y)))
double code(double x, double y, double z) {
return fma(y, (log(z) - z), fma(0.5, x, y));
}
function code(x, y, z) return fma(y, Float64(log(z) - z), fma(0.5, x, y)) end
code[x_, y_, z_] := N[(y * N[(N[Log[z], $MachinePrecision] - z), $MachinePrecision] + N[(0.5 * x + y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y, \log z - z, \mathsf{fma}\left(0.5, x, y\right)\right)
\end{array}
Initial program 99.9%
Taylor expanded in x around 0
sub-negN/A
associate-+r+N/A
mul-1-negN/A
distribute-lft-inN/A
*-rgt-identityN/A
associate-+r+N/A
+-commutativeN/A
lower-fma.f64N/A
mul-1-negN/A
sub-negN/A
lower--.f64N/A
lower-log.f64N/A
lower-fma.f6499.9
Simplified99.9%
(FPCore (x y z) :precision binary64 (fma (- z) y (* x 0.5)))
double code(double x, double y, double z) {
return fma(-z, y, (x * 0.5));
}
function code(x, y, z) return fma(Float64(-z), y, Float64(x * 0.5)) end
code[x_, y_, z_] := N[((-z) * y + N[(x * 0.5), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(-z, y, x \cdot 0.5\right)
\end{array}
Initial program 99.9%
Taylor expanded in z around inf
mul-1-negN/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
lower-neg.f6476.5
Simplified76.5%
lift-*.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6476.5
Applied egg-rr76.5%
(FPCore (x y z) :precision binary64 (fma x 0.5 (* y (- z))))
double code(double x, double y, double z) {
return fma(x, 0.5, (y * -z));
}
function code(x, y, z) return fma(x, 0.5, Float64(y * Float64(-z))) end
code[x_, y_, z_] := N[(x * 0.5 + N[(y * (-z)), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x, 0.5, y \cdot \left(-z\right)\right)
\end{array}
Initial program 99.9%
Taylor expanded in z around inf
mul-1-negN/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
lower-neg.f6476.5
Simplified76.5%
lift-neg.f64N/A
lift-*.f64N/A
lower-fma.f6476.5
lift-*.f64N/A
lift-neg.f64N/A
distribute-rgt-neg-outN/A
lower-neg.f64N/A
lower-*.f6476.5
Applied egg-rr76.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
lower-*.f6443.0
Simplified43.0%
Final simplification43.0%
(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 2024208
(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)))))