
(FPCore (x y z) :precision binary64 (* (+ x y) (+ z 1.0)))
double code(double x, double y, double z) {
return (x + y) * (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 + y) * (z + 1.0d0)
end function
public static double code(double x, double y, double z) {
return (x + y) * (z + 1.0);
}
def code(x, y, z): return (x + y) * (z + 1.0)
function code(x, y, z) return Float64(Float64(x + y) * Float64(z + 1.0)) end
function tmp = code(x, y, z) tmp = (x + y) * (z + 1.0); end
code[x_, y_, z_] := N[(N[(x + y), $MachinePrecision] * N[(z + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + y\right) \cdot \left(z + 1\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (* (+ x y) (+ z 1.0)))
double code(double x, double y, double z) {
return (x + y) * (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 + y) * (z + 1.0d0)
end function
public static double code(double x, double y, double z) {
return (x + y) * (z + 1.0);
}
def code(x, y, z): return (x + y) * (z + 1.0)
function code(x, y, z) return Float64(Float64(x + y) * Float64(z + 1.0)) end
function tmp = code(x, y, z) tmp = (x + y) * (z + 1.0); end
code[x_, y_, z_] := N[(N[(x + y), $MachinePrecision] * N[(z + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + y\right) \cdot \left(z + 1\right)
\end{array}
(FPCore (x y z) :precision binary64 (+ (+ x y) (* (+ x y) z)))
double code(double x, double y, double z) {
return (x + y) + ((x + 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 + y) + ((x + y) * z)
end function
public static double code(double x, double y, double z) {
return (x + y) + ((x + y) * z);
}
def code(x, y, z): return (x + y) + ((x + y) * z)
function code(x, y, z) return Float64(Float64(x + y) + Float64(Float64(x + y) * z)) end
function tmp = code(x, y, z) tmp = (x + y) + ((x + y) * z); end
code[x_, y_, z_] := N[(N[(x + y), $MachinePrecision] + N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + y\right) + \left(x + y\right) \cdot z
\end{array}
Initial program 100.0%
+-commutative100.0%
distribute-lft-in100.0%
*-rgt-identity100.0%
Applied egg-rr100.0%
(FPCore (x y z)
:precision binary64
(if (<= z -4.9e+117)
(* y z)
(if (<= z -1.7e+70)
(* x z)
(if (<= z -1.0)
(* y z)
(if (<= z -7.4e-69)
x
(if (<= z -7.2e-112)
y
(if (<= z -2.2e-201)
x
(if (<= z 0.0165) y (if (<= z 8.2e+138) (* y z) (* x z))))))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -4.9e+117) {
tmp = y * z;
} else if (z <= -1.7e+70) {
tmp = x * z;
} else if (z <= -1.0) {
tmp = y * z;
} else if (z <= -7.4e-69) {
tmp = x;
} else if (z <= -7.2e-112) {
tmp = y;
} else if (z <= -2.2e-201) {
tmp = x;
} else if (z <= 0.0165) {
tmp = y;
} else if (z <= 8.2e+138) {
tmp = y * z;
} else {
tmp = x * 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 <= (-4.9d+117)) then
tmp = y * z
else if (z <= (-1.7d+70)) then
tmp = x * z
else if (z <= (-1.0d0)) then
tmp = y * z
else if (z <= (-7.4d-69)) then
tmp = x
else if (z <= (-7.2d-112)) then
tmp = y
else if (z <= (-2.2d-201)) then
tmp = x
else if (z <= 0.0165d0) then
tmp = y
else if (z <= 8.2d+138) then
tmp = y * z
else
tmp = x * z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -4.9e+117) {
tmp = y * z;
} else if (z <= -1.7e+70) {
tmp = x * z;
} else if (z <= -1.0) {
tmp = y * z;
} else if (z <= -7.4e-69) {
tmp = x;
} else if (z <= -7.2e-112) {
tmp = y;
} else if (z <= -2.2e-201) {
tmp = x;
} else if (z <= 0.0165) {
tmp = y;
} else if (z <= 8.2e+138) {
tmp = y * z;
} else {
tmp = x * z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -4.9e+117: tmp = y * z elif z <= -1.7e+70: tmp = x * z elif z <= -1.0: tmp = y * z elif z <= -7.4e-69: tmp = x elif z <= -7.2e-112: tmp = y elif z <= -2.2e-201: tmp = x elif z <= 0.0165: tmp = y elif z <= 8.2e+138: tmp = y * z else: tmp = x * z return tmp
function code(x, y, z) tmp = 0.0 if (z <= -4.9e+117) tmp = Float64(y * z); elseif (z <= -1.7e+70) tmp = Float64(x * z); elseif (z <= -1.0) tmp = Float64(y * z); elseif (z <= -7.4e-69) tmp = x; elseif (z <= -7.2e-112) tmp = y; elseif (z <= -2.2e-201) tmp = x; elseif (z <= 0.0165) tmp = y; elseif (z <= 8.2e+138) tmp = Float64(y * z); else tmp = Float64(x * z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -4.9e+117) tmp = y * z; elseif (z <= -1.7e+70) tmp = x * z; elseif (z <= -1.0) tmp = y * z; elseif (z <= -7.4e-69) tmp = x; elseif (z <= -7.2e-112) tmp = y; elseif (z <= -2.2e-201) tmp = x; elseif (z <= 0.0165) tmp = y; elseif (z <= 8.2e+138) tmp = y * z; else tmp = x * z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -4.9e+117], N[(y * z), $MachinePrecision], If[LessEqual[z, -1.7e+70], N[(x * z), $MachinePrecision], If[LessEqual[z, -1.0], N[(y * z), $MachinePrecision], If[LessEqual[z, -7.4e-69], x, If[LessEqual[z, -7.2e-112], y, If[LessEqual[z, -2.2e-201], x, If[LessEqual[z, 0.0165], y, If[LessEqual[z, 8.2e+138], N[(y * z), $MachinePrecision], N[(x * z), $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.9 \cdot 10^{+117}:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;z \leq -1.7 \cdot 10^{+70}:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z \leq -1:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;z \leq -7.4 \cdot 10^{-69}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq -7.2 \cdot 10^{-112}:\\
\;\;\;\;y\\
\mathbf{elif}\;z \leq -2.2 \cdot 10^{-201}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 0.0165:\\
\;\;\;\;y\\
\mathbf{elif}\;z \leq 8.2 \cdot 10^{+138}:\\
\;\;\;\;y \cdot z\\
\mathbf{else}:\\
\;\;\;\;x \cdot z\\
\end{array}
\end{array}
if z < -4.9000000000000001e117 or -1.7e70 < z < -1 or 0.016500000000000001 < z < 8.19999999999999961e138Initial program 100.0%
Taylor expanded in z around inf 96.5%
Taylor expanded in x around 0 50.9%
if -4.9000000000000001e117 < z < -1.7e70 or 8.19999999999999961e138 < z Initial program 100.0%
Taylor expanded in z around inf 100.0%
Taylor expanded in x around inf 52.6%
*-commutative52.6%
Simplified52.6%
if -1 < z < -7.4000000000000005e-69 or -7.2000000000000002e-112 < z < -2.2e-201Initial program 100.0%
Taylor expanded in z around 0 100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in y around 0 47.8%
if -7.4000000000000005e-69 < z < -7.2000000000000002e-112 or -2.2e-201 < z < 0.016500000000000001Initial program 100.0%
Taylor expanded in z around 0 99.3%
+-commutative99.3%
Simplified99.3%
Taylor expanded in y around inf 42.4%
Final simplification47.6%
(FPCore (x y z)
:precision binary64
(if (<= z -1.0)
(* y z)
(if (<= z -7.4e-69)
x
(if (<= z -1.1e-109)
y
(if (<= z -1.9e-198)
x
(if (<= z 2.6e-227)
y
(if (<= z 2.8e-198) x (if (<= z 0.0165) y (* y z)))))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.0) {
tmp = y * z;
} else if (z <= -7.4e-69) {
tmp = x;
} else if (z <= -1.1e-109) {
tmp = y;
} else if (z <= -1.9e-198) {
tmp = x;
} else if (z <= 2.6e-227) {
tmp = y;
} else if (z <= 2.8e-198) {
tmp = x;
} else if (z <= 0.0165) {
tmp = y;
} 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.0d0)) then
tmp = y * z
else if (z <= (-7.4d-69)) then
tmp = x
else if (z <= (-1.1d-109)) then
tmp = y
else if (z <= (-1.9d-198)) then
tmp = x
else if (z <= 2.6d-227) then
tmp = y
else if (z <= 2.8d-198) then
tmp = x
else if (z <= 0.0165d0) then
tmp = y
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.0) {
tmp = y * z;
} else if (z <= -7.4e-69) {
tmp = x;
} else if (z <= -1.1e-109) {
tmp = y;
} else if (z <= -1.9e-198) {
tmp = x;
} else if (z <= 2.6e-227) {
tmp = y;
} else if (z <= 2.8e-198) {
tmp = x;
} else if (z <= 0.0165) {
tmp = y;
} else {
tmp = y * z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.0: tmp = y * z elif z <= -7.4e-69: tmp = x elif z <= -1.1e-109: tmp = y elif z <= -1.9e-198: tmp = x elif z <= 2.6e-227: tmp = y elif z <= 2.8e-198: tmp = x elif z <= 0.0165: tmp = y else: tmp = y * z return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.0) tmp = Float64(y * z); elseif (z <= -7.4e-69) tmp = x; elseif (z <= -1.1e-109) tmp = y; elseif (z <= -1.9e-198) tmp = x; elseif (z <= 2.6e-227) tmp = y; elseif (z <= 2.8e-198) tmp = x; elseif (z <= 0.0165) tmp = y; else tmp = Float64(y * z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.0) tmp = y * z; elseif (z <= -7.4e-69) tmp = x; elseif (z <= -1.1e-109) tmp = y; elseif (z <= -1.9e-198) tmp = x; elseif (z <= 2.6e-227) tmp = y; elseif (z <= 2.8e-198) tmp = x; elseif (z <= 0.0165) tmp = y; else tmp = y * z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.0], N[(y * z), $MachinePrecision], If[LessEqual[z, -7.4e-69], x, If[LessEqual[z, -1.1e-109], y, If[LessEqual[z, -1.9e-198], x, If[LessEqual[z, 2.6e-227], y, If[LessEqual[z, 2.8e-198], x, If[LessEqual[z, 0.0165], y, N[(y * z), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;z \leq -7.4 \cdot 10^{-69}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq -1.1 \cdot 10^{-109}:\\
\;\;\;\;y\\
\mathbf{elif}\;z \leq -1.9 \cdot 10^{-198}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 2.6 \cdot 10^{-227}:\\
\;\;\;\;y\\
\mathbf{elif}\;z \leq 2.8 \cdot 10^{-198}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 0.0165:\\
\;\;\;\;y\\
\mathbf{else}:\\
\;\;\;\;y \cdot z\\
\end{array}
\end{array}
if z < -1 or 0.016500000000000001 < z Initial program 100.0%
Taylor expanded in z around inf 98.0%
Taylor expanded in x around 0 51.5%
if -1 < z < -7.4000000000000005e-69 or -1.1e-109 < z < -1.9000000000000001e-198 or 2.60000000000000011e-227 < z < 2.7999999999999999e-198Initial program 100.0%
Taylor expanded in z around 0 100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in y around 0 50.0%
if -7.4000000000000005e-69 < z < -1.1e-109 or -1.9000000000000001e-198 < z < 2.60000000000000011e-227 or 2.7999999999999999e-198 < z < 0.016500000000000001Initial program 100.0%
Taylor expanded in z around 0 99.2%
+-commutative99.2%
Simplified99.2%
Taylor expanded in y around inf 42.2%
(FPCore (x y z)
:precision binary64
(if (<= (+ z 1.0) -2e+118)
(* y z)
(if (<= (+ z 1.0) -2e+70)
(* x z)
(if (<= (+ z 1.0) -5000.0)
(* y z)
(if (<= (+ z 1.0) 10000000000000.0)
(+ x y)
(if (<= (+ z 1.0) 4e+138) (* y z) (* x z)))))))
double code(double x, double y, double z) {
double tmp;
if ((z + 1.0) <= -2e+118) {
tmp = y * z;
} else if ((z + 1.0) <= -2e+70) {
tmp = x * z;
} else if ((z + 1.0) <= -5000.0) {
tmp = y * z;
} else if ((z + 1.0) <= 10000000000000.0) {
tmp = x + y;
} else if ((z + 1.0) <= 4e+138) {
tmp = y * z;
} else {
tmp = x * 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.0d0) <= (-2d+118)) then
tmp = y * z
else if ((z + 1.0d0) <= (-2d+70)) then
tmp = x * z
else if ((z + 1.0d0) <= (-5000.0d0)) then
tmp = y * z
else if ((z + 1.0d0) <= 10000000000000.0d0) then
tmp = x + y
else if ((z + 1.0d0) <= 4d+138) then
tmp = y * z
else
tmp = x * z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z + 1.0) <= -2e+118) {
tmp = y * z;
} else if ((z + 1.0) <= -2e+70) {
tmp = x * z;
} else if ((z + 1.0) <= -5000.0) {
tmp = y * z;
} else if ((z + 1.0) <= 10000000000000.0) {
tmp = x + y;
} else if ((z + 1.0) <= 4e+138) {
tmp = y * z;
} else {
tmp = x * z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z + 1.0) <= -2e+118: tmp = y * z elif (z + 1.0) <= -2e+70: tmp = x * z elif (z + 1.0) <= -5000.0: tmp = y * z elif (z + 1.0) <= 10000000000000.0: tmp = x + y elif (z + 1.0) <= 4e+138: tmp = y * z else: tmp = x * z return tmp
function code(x, y, z) tmp = 0.0 if (Float64(z + 1.0) <= -2e+118) tmp = Float64(y * z); elseif (Float64(z + 1.0) <= -2e+70) tmp = Float64(x * z); elseif (Float64(z + 1.0) <= -5000.0) tmp = Float64(y * z); elseif (Float64(z + 1.0) <= 10000000000000.0) tmp = Float64(x + y); elseif (Float64(z + 1.0) <= 4e+138) tmp = Float64(y * z); else tmp = Float64(x * z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z + 1.0) <= -2e+118) tmp = y * z; elseif ((z + 1.0) <= -2e+70) tmp = x * z; elseif ((z + 1.0) <= -5000.0) tmp = y * z; elseif ((z + 1.0) <= 10000000000000.0) tmp = x + y; elseif ((z + 1.0) <= 4e+138) tmp = y * z; else tmp = x * z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[N[(z + 1.0), $MachinePrecision], -2e+118], N[(y * z), $MachinePrecision], If[LessEqual[N[(z + 1.0), $MachinePrecision], -2e+70], N[(x * z), $MachinePrecision], If[LessEqual[N[(z + 1.0), $MachinePrecision], -5000.0], N[(y * z), $MachinePrecision], If[LessEqual[N[(z + 1.0), $MachinePrecision], 10000000000000.0], N[(x + y), $MachinePrecision], If[LessEqual[N[(z + 1.0), $MachinePrecision], 4e+138], N[(y * z), $MachinePrecision], N[(x * z), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z + 1 \leq -2 \cdot 10^{+118}:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;z + 1 \leq -2 \cdot 10^{+70}:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z + 1 \leq -5000:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;z + 1 \leq 10000000000000:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z + 1 \leq 4 \cdot 10^{+138}:\\
\;\;\;\;y \cdot z\\
\mathbf{else}:\\
\;\;\;\;x \cdot z\\
\end{array}
\end{array}
if (+.f64 z #s(literal 1 binary64)) < -1.99999999999999993e118 or -2.00000000000000015e70 < (+.f64 z #s(literal 1 binary64)) < -5e3 or 1e13 < (+.f64 z #s(literal 1 binary64)) < 4.0000000000000001e138Initial program 100.0%
Taylor expanded in z around inf 98.7%
Taylor expanded in x around 0 52.7%
if -1.99999999999999993e118 < (+.f64 z #s(literal 1 binary64)) < -2.00000000000000015e70 or 4.0000000000000001e138 < (+.f64 z #s(literal 1 binary64)) Initial program 100.0%
Taylor expanded in z around inf 100.0%
Taylor expanded in x around inf 52.6%
*-commutative52.6%
Simplified52.6%
if -5e3 < (+.f64 z #s(literal 1 binary64)) < 1e13Initial program 100.0%
Taylor expanded in z around 0 97.6%
+-commutative97.6%
Simplified97.6%
Final simplification75.6%
(FPCore (x y z) :precision binary64 (if (<= (+ x y) -4e-224) (* x (+ z 1.0)) (+ y (* y z))))
double code(double x, double y, double z) {
double tmp;
if ((x + y) <= -4e-224) {
tmp = x * (z + 1.0);
} else {
tmp = y + (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 ((x + y) <= (-4d-224)) then
tmp = x * (z + 1.0d0)
else
tmp = y + (y * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x + y) <= -4e-224) {
tmp = x * (z + 1.0);
} else {
tmp = y + (y * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x + y) <= -4e-224: tmp = x * (z + 1.0) else: tmp = y + (y * z) return tmp
function code(x, y, z) tmp = 0.0 if (Float64(x + y) <= -4e-224) tmp = Float64(x * Float64(z + 1.0)); else tmp = Float64(y + Float64(y * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x + y) <= -4e-224) tmp = x * (z + 1.0); else tmp = y + (y * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[N[(x + y), $MachinePrecision], -4e-224], N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision], N[(y + N[(y * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq -4 \cdot 10^{-224}:\\
\;\;\;\;x \cdot \left(z + 1\right)\\
\mathbf{else}:\\
\;\;\;\;y + y \cdot z\\
\end{array}
\end{array}
if (+.f64 x y) < -4.0000000000000001e-224Initial program 100.0%
Taylor expanded in x around inf 55.5%
if -4.0000000000000001e-224 < (+.f64 x y) Initial program 100.0%
Taylor expanded in x around 0 51.4%
distribute-lft-in51.5%
*-rgt-identity51.5%
Applied egg-rr51.5%
Final simplification53.4%
(FPCore (x y z) :precision binary64 (if (<= (+ x y) -4e-224) (* x (+ z 1.0)) (* y (+ z 1.0))))
double code(double x, double y, double z) {
double tmp;
if ((x + y) <= -4e-224) {
tmp = x * (z + 1.0);
} else {
tmp = y * (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 ((x + y) <= (-4d-224)) then
tmp = x * (z + 1.0d0)
else
tmp = y * (z + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x + y) <= -4e-224) {
tmp = x * (z + 1.0);
} else {
tmp = y * (z + 1.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x + y) <= -4e-224: tmp = x * (z + 1.0) else: tmp = y * (z + 1.0) return tmp
function code(x, y, z) tmp = 0.0 if (Float64(x + y) <= -4e-224) tmp = Float64(x * Float64(z + 1.0)); else tmp = Float64(y * Float64(z + 1.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x + y) <= -4e-224) tmp = x * (z + 1.0); else tmp = y * (z + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[N[(x + y), $MachinePrecision], -4e-224], N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision], N[(y * N[(z + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq -4 \cdot 10^{-224}:\\
\;\;\;\;x \cdot \left(z + 1\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(z + 1\right)\\
\end{array}
\end{array}
if (+.f64 x y) < -4.0000000000000001e-224Initial program 100.0%
Taylor expanded in x around inf 55.5%
if -4.0000000000000001e-224 < (+.f64 x y) Initial program 100.0%
Taylor expanded in x around 0 51.4%
(FPCore (x y z) :precision binary64 (* (+ x y) (+ z 1.0)))
double code(double x, double y, double z) {
return (x + y) * (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 + y) * (z + 1.0d0)
end function
public static double code(double x, double y, double z) {
return (x + y) * (z + 1.0);
}
def code(x, y, z): return (x + y) * (z + 1.0)
function code(x, y, z) return Float64(Float64(x + y) * Float64(z + 1.0)) end
function tmp = code(x, y, z) tmp = (x + y) * (z + 1.0); end
code[x_, y_, z_] := N[(N[(x + y), $MachinePrecision] * N[(z + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + y\right) \cdot \left(z + 1\right)
\end{array}
Initial program 100.0%
(FPCore (x y z) :precision binary64 (if (<= y 2.3e-148) x y))
double code(double x, double y, double z) {
double tmp;
if (y <= 2.3e-148) {
tmp = x;
} else {
tmp = 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 (y <= 2.3d-148) then
tmp = x
else
tmp = y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 2.3e-148) {
tmp = x;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 2.3e-148: tmp = x else: tmp = y return tmp
function code(x, y, z) tmp = 0.0 if (y <= 2.3e-148) tmp = x; else tmp = y; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 2.3e-148) tmp = x; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 2.3e-148], x, y]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.3 \cdot 10^{-148}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if y < 2.29999999999999997e-148Initial program 100.0%
Taylor expanded in z around 0 57.1%
+-commutative57.1%
Simplified57.1%
Taylor expanded in y around 0 37.6%
if 2.29999999999999997e-148 < y Initial program 100.0%
Taylor expanded in z around 0 43.1%
+-commutative43.1%
Simplified43.1%
Taylor expanded in y around inf 29.9%
(FPCore (x y z) :precision binary64 x)
double code(double x, double y, double z) {
return x;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x
end function
public static double code(double x, double y, double z) {
return x;
}
def code(x, y, z): return x
function code(x, y, z) return x end
function tmp = code(x, y, z) tmp = x; end
code[x_, y_, z_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 100.0%
Taylor expanded in z around 0 51.7%
+-commutative51.7%
Simplified51.7%
Taylor expanded in y around 0 29.4%
herbie shell --seed 2024110
(FPCore (x y z)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, G"
:precision binary64
(* (+ x y) (+ z 1.0)))