
(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) (+ 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%
Final simplification100.0%
(FPCore (x y z)
:precision binary64
(if (<= z -1.0)
(* y z)
(if (<= z -1.16e-139)
x
(if (<= z 5.8e-249)
y
(if (<= z 5.7e-214)
x
(if (<= z 4.2e-184)
y
(if (<= z 1e-128)
x
(if (<= z 510000.0) y (if (<= z 6e+29) (* y z) (* x z))))))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.0) {
tmp = y * z;
} else if (z <= -1.16e-139) {
tmp = x;
} else if (z <= 5.8e-249) {
tmp = y;
} else if (z <= 5.7e-214) {
tmp = x;
} else if (z <= 4.2e-184) {
tmp = y;
} else if (z <= 1e-128) {
tmp = x;
} else if (z <= 510000.0) {
tmp = y;
} else if (z <= 6e+29) {
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)) then
tmp = y * z
else if (z <= (-1.16d-139)) then
tmp = x
else if (z <= 5.8d-249) then
tmp = y
else if (z <= 5.7d-214) then
tmp = x
else if (z <= 4.2d-184) then
tmp = y
else if (z <= 1d-128) then
tmp = x
else if (z <= 510000.0d0) then
tmp = y
else if (z <= 6d+29) 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) {
tmp = y * z;
} else if (z <= -1.16e-139) {
tmp = x;
} else if (z <= 5.8e-249) {
tmp = y;
} else if (z <= 5.7e-214) {
tmp = x;
} else if (z <= 4.2e-184) {
tmp = y;
} else if (z <= 1e-128) {
tmp = x;
} else if (z <= 510000.0) {
tmp = y;
} else if (z <= 6e+29) {
tmp = y * z;
} else {
tmp = x * z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.0: tmp = y * z elif z <= -1.16e-139: tmp = x elif z <= 5.8e-249: tmp = y elif z <= 5.7e-214: tmp = x elif z <= 4.2e-184: tmp = y elif z <= 1e-128: tmp = x elif z <= 510000.0: tmp = y elif z <= 6e+29: tmp = y * z else: tmp = x * z return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.0) tmp = Float64(y * z); elseif (z <= -1.16e-139) tmp = x; elseif (z <= 5.8e-249) tmp = y; elseif (z <= 5.7e-214) tmp = x; elseif (z <= 4.2e-184) tmp = y; elseif (z <= 1e-128) tmp = x; elseif (z <= 510000.0) tmp = y; elseif (z <= 6e+29) 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) tmp = y * z; elseif (z <= -1.16e-139) tmp = x; elseif (z <= 5.8e-249) tmp = y; elseif (z <= 5.7e-214) tmp = x; elseif (z <= 4.2e-184) tmp = y; elseif (z <= 1e-128) tmp = x; elseif (z <= 510000.0) tmp = y; elseif (z <= 6e+29) tmp = y * z; else tmp = x * z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.0], N[(y * z), $MachinePrecision], If[LessEqual[z, -1.16e-139], x, If[LessEqual[z, 5.8e-249], y, If[LessEqual[z, 5.7e-214], x, If[LessEqual[z, 4.2e-184], y, If[LessEqual[z, 1e-128], x, If[LessEqual[z, 510000.0], y, If[LessEqual[z, 6e+29], N[(y * z), $MachinePrecision], N[(x * z), $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;z \leq -1.16 \cdot 10^{-139}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 5.8 \cdot 10^{-249}:\\
\;\;\;\;y\\
\mathbf{elif}\;z \leq 5.7 \cdot 10^{-214}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 4.2 \cdot 10^{-184}:\\
\;\;\;\;y\\
\mathbf{elif}\;z \leq 10^{-128}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 510000:\\
\;\;\;\;y\\
\mathbf{elif}\;z \leq 6 \cdot 10^{+29}:\\
\;\;\;\;y \cdot z\\
\mathbf{else}:\\
\;\;\;\;x \cdot z\\
\end{array}
\end{array}
if z < -1 or 5.1e5 < z < 5.9999999999999998e29Initial program 100.0%
+-commutative100.0%
distribute-lft-in99.9%
*-rgt-identity99.9%
Applied egg-rr99.9%
Taylor expanded in x around 0 53.7%
Taylor expanded in z around inf 50.3%
if -1 < z < -1.15999999999999999e-139 or 5.80000000000000044e-249 < z < 5.6999999999999996e-214 or 4.1999999999999998e-184 < z < 1.00000000000000005e-128Initial program 100.0%
Taylor expanded in x around inf 59.7%
Taylor expanded in z around 0 56.5%
if -1.15999999999999999e-139 < z < 5.80000000000000044e-249 or 5.6999999999999996e-214 < z < 4.1999999999999998e-184 or 1.00000000000000005e-128 < z < 5.1e5Initial program 100.0%
Taylor expanded in x around 0 40.5%
Taylor expanded in z around 0 38.9%
if 5.9999999999999998e29 < z Initial program 100.0%
+-commutative100.0%
distribute-lft-in100.0%
*-rgt-identity100.0%
Applied egg-rr100.0%
associate-+l+100.0%
flip-+29.3%
+-commutative29.3%
fma-def29.3%
+-commutative29.3%
fma-def29.3%
+-commutative29.3%
fma-def29.3%
Applied egg-rr29.3%
difference-of-squares29.3%
+-commutative29.3%
fma-udef29.3%
associate-+r+29.3%
+-commutative29.3%
*-rgt-identity29.3%
distribute-lft-in29.3%
associate-/l*61.5%
*-inverses100.0%
associate-/l*99.6%
+-commutative99.6%
Simplified99.6%
Taylor expanded in z around inf 99.6%
Taylor expanded in y around 0 39.5%
Final simplification45.2%
(FPCore (x y z)
:precision binary64
(if (<= z -1.0)
(* y z)
(if (<= z -2.3e-137)
x
(if (<= z 2.85e-248)
y
(if (<= z 1.2e-214)
x
(if (<= z 3.2e-178)
y
(if (<= z 8.6e-128) x (if (<= z 510000.0) y (* y z)))))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.0) {
tmp = y * z;
} else if (z <= -2.3e-137) {
tmp = x;
} else if (z <= 2.85e-248) {
tmp = y;
} else if (z <= 1.2e-214) {
tmp = x;
} else if (z <= 3.2e-178) {
tmp = y;
} else if (z <= 8.6e-128) {
tmp = x;
} else if (z <= 510000.0) {
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 <= (-2.3d-137)) then
tmp = x
else if (z <= 2.85d-248) then
tmp = y
else if (z <= 1.2d-214) then
tmp = x
else if (z <= 3.2d-178) then
tmp = y
else if (z <= 8.6d-128) then
tmp = x
else if (z <= 510000.0d0) 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 <= -2.3e-137) {
tmp = x;
} else if (z <= 2.85e-248) {
tmp = y;
} else if (z <= 1.2e-214) {
tmp = x;
} else if (z <= 3.2e-178) {
tmp = y;
} else if (z <= 8.6e-128) {
tmp = x;
} else if (z <= 510000.0) {
tmp = y;
} else {
tmp = y * z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.0: tmp = y * z elif z <= -2.3e-137: tmp = x elif z <= 2.85e-248: tmp = y elif z <= 1.2e-214: tmp = x elif z <= 3.2e-178: tmp = y elif z <= 8.6e-128: tmp = x elif z <= 510000.0: 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 <= -2.3e-137) tmp = x; elseif (z <= 2.85e-248) tmp = y; elseif (z <= 1.2e-214) tmp = x; elseif (z <= 3.2e-178) tmp = y; elseif (z <= 8.6e-128) tmp = x; elseif (z <= 510000.0) 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 <= -2.3e-137) tmp = x; elseif (z <= 2.85e-248) tmp = y; elseif (z <= 1.2e-214) tmp = x; elseif (z <= 3.2e-178) tmp = y; elseif (z <= 8.6e-128) tmp = x; elseif (z <= 510000.0) 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, -2.3e-137], x, If[LessEqual[z, 2.85e-248], y, If[LessEqual[z, 1.2e-214], x, If[LessEqual[z, 3.2e-178], y, If[LessEqual[z, 8.6e-128], x, If[LessEqual[z, 510000.0], y, N[(y * z), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;z \leq -2.3 \cdot 10^{-137}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 2.85 \cdot 10^{-248}:\\
\;\;\;\;y\\
\mathbf{elif}\;z \leq 1.2 \cdot 10^{-214}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 3.2 \cdot 10^{-178}:\\
\;\;\;\;y\\
\mathbf{elif}\;z \leq 8.6 \cdot 10^{-128}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 510000:\\
\;\;\;\;y\\
\mathbf{else}:\\
\;\;\;\;y \cdot z\\
\end{array}
\end{array}
if z < -1 or 5.1e5 < z Initial program 100.0%
+-commutative100.0%
distribute-lft-in99.9%
*-rgt-identity99.9%
Applied egg-rr99.9%
Taylor expanded in x around 0 57.4%
Taylor expanded in z around inf 55.5%
if -1 < z < -2.30000000000000008e-137 or 2.8499999999999999e-248 < z < 1.2000000000000001e-214 or 3.2000000000000001e-178 < z < 8.59999999999999988e-128Initial program 100.0%
Taylor expanded in x around inf 59.7%
Taylor expanded in z around 0 56.5%
if -2.30000000000000008e-137 < z < 2.8499999999999999e-248 or 1.2000000000000001e-214 < z < 3.2000000000000001e-178 or 8.59999999999999988e-128 < z < 5.1e5Initial program 100.0%
Taylor expanded in x around 0 40.5%
Taylor expanded in z around 0 38.9%
Final simplification49.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* y (+ z 1.0))))
(if (<= z -0.0023)
t_0
(if (<= z 1.3e-5) (+ x y) (if (<= z 1.4e+26) t_0 (* x z))))))
double code(double x, double y, double z) {
double t_0 = y * (z + 1.0);
double tmp;
if (z <= -0.0023) {
tmp = t_0;
} else if (z <= 1.3e-5) {
tmp = x + y;
} else if (z <= 1.4e+26) {
tmp = t_0;
} 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) :: t_0
real(8) :: tmp
t_0 = y * (z + 1.0d0)
if (z <= (-0.0023d0)) then
tmp = t_0
else if (z <= 1.3d-5) then
tmp = x + y
else if (z <= 1.4d+26) then
tmp = t_0
else
tmp = x * z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = y * (z + 1.0);
double tmp;
if (z <= -0.0023) {
tmp = t_0;
} else if (z <= 1.3e-5) {
tmp = x + y;
} else if (z <= 1.4e+26) {
tmp = t_0;
} else {
tmp = x * z;
}
return tmp;
}
def code(x, y, z): t_0 = y * (z + 1.0) tmp = 0 if z <= -0.0023: tmp = t_0 elif z <= 1.3e-5: tmp = x + y elif z <= 1.4e+26: tmp = t_0 else: tmp = x * z return tmp
function code(x, y, z) t_0 = Float64(y * Float64(z + 1.0)) tmp = 0.0 if (z <= -0.0023) tmp = t_0; elseif (z <= 1.3e-5) tmp = Float64(x + y); elseif (z <= 1.4e+26) tmp = t_0; else tmp = Float64(x * z); end return tmp end
function tmp_2 = code(x, y, z) t_0 = y * (z + 1.0); tmp = 0.0; if (z <= -0.0023) tmp = t_0; elseif (z <= 1.3e-5) tmp = x + y; elseif (z <= 1.4e+26) tmp = t_0; else tmp = x * z; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(y * N[(z + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -0.0023], t$95$0, If[LessEqual[z, 1.3e-5], N[(x + y), $MachinePrecision], If[LessEqual[z, 1.4e+26], t$95$0, N[(x * z), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y \cdot \left(z + 1\right)\\
\mathbf{if}\;z \leq -0.0023:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 1.3 \cdot 10^{-5}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq 1.4 \cdot 10^{+26}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;x \cdot z\\
\end{array}
\end{array}
if z < -0.0023 or 1.29999999999999992e-5 < z < 1.4e26Initial program 99.9%
Taylor expanded in x around 0 52.7%
if -0.0023 < z < 1.29999999999999992e-5Initial program 100.0%
Taylor expanded in z around 0 97.7%
if 1.4e26 < z Initial program 100.0%
+-commutative100.0%
distribute-lft-in100.0%
*-rgt-identity100.0%
Applied egg-rr100.0%
associate-+l+100.0%
flip-+29.3%
+-commutative29.3%
fma-def29.3%
+-commutative29.3%
fma-def29.3%
+-commutative29.3%
fma-def29.3%
Applied egg-rr29.3%
difference-of-squares29.3%
+-commutative29.3%
fma-udef29.3%
associate-+r+29.3%
+-commutative29.3%
*-rgt-identity29.3%
distribute-lft-in29.3%
associate-/l*61.5%
*-inverses100.0%
associate-/l*99.6%
+-commutative99.6%
Simplified99.6%
Taylor expanded in z around inf 99.6%
Taylor expanded in y around 0 39.5%
Final simplification73.6%
(FPCore (x y z) :precision binary64 (if (<= z -1.0) (* y z) (if (<= z 510000.0) (+ x y) (if (<= z 6e+33) (* y z) (* x z)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.0) {
tmp = y * z;
} else if (z <= 510000.0) {
tmp = x + y;
} else if (z <= 6e+33) {
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)) then
tmp = y * z
else if (z <= 510000.0d0) then
tmp = x + y
else if (z <= 6d+33) 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) {
tmp = y * z;
} else if (z <= 510000.0) {
tmp = x + y;
} else if (z <= 6e+33) {
tmp = y * z;
} else {
tmp = x * z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.0: tmp = y * z elif z <= 510000.0: tmp = x + y elif z <= 6e+33: tmp = y * z else: tmp = x * z return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.0) tmp = Float64(y * z); elseif (z <= 510000.0) tmp = Float64(x + y); elseif (z <= 6e+33) 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) tmp = y * z; elseif (z <= 510000.0) tmp = x + y; elseif (z <= 6e+33) tmp = y * z; else tmp = x * z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.0], N[(y * z), $MachinePrecision], If[LessEqual[z, 510000.0], N[(x + y), $MachinePrecision], If[LessEqual[z, 6e+33], N[(y * z), $MachinePrecision], N[(x * z), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;z \leq 510000:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq 6 \cdot 10^{+33}:\\
\;\;\;\;y \cdot z\\
\mathbf{else}:\\
\;\;\;\;x \cdot z\\
\end{array}
\end{array}
if z < -1 or 5.1e5 < z < 5.99999999999999967e33Initial program 100.0%
+-commutative100.0%
distribute-lft-in99.9%
*-rgt-identity99.9%
Applied egg-rr99.9%
Taylor expanded in x around 0 53.7%
Taylor expanded in z around inf 50.3%
if -1 < z < 5.1e5Initial program 100.0%
Taylor expanded in z around 0 95.1%
if 5.99999999999999967e33 < z Initial program 100.0%
+-commutative100.0%
distribute-lft-in100.0%
*-rgt-identity100.0%
Applied egg-rr100.0%
associate-+l+100.0%
flip-+29.3%
+-commutative29.3%
fma-def29.3%
+-commutative29.3%
fma-def29.3%
+-commutative29.3%
fma-def29.3%
Applied egg-rr29.3%
difference-of-squares29.3%
+-commutative29.3%
fma-udef29.3%
associate-+r+29.3%
+-commutative29.3%
*-rgt-identity29.3%
distribute-lft-in29.3%
associate-/l*61.5%
*-inverses100.0%
associate-/l*99.6%
+-commutative99.6%
Simplified99.6%
Taylor expanded in z around inf 99.6%
Taylor expanded in y around 0 39.5%
Final simplification72.4%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.0) (not (<= z 1.0))) (* z (+ x y)) (+ x y)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.0) || !(z <= 1.0)) {
tmp = z * (x + y);
} else {
tmp = x + 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 <= (-1.0d0)) .or. (.not. (z <= 1.0d0))) then
tmp = z * (x + y)
else
tmp = x + y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -1.0) || !(z <= 1.0)) {
tmp = z * (x + y);
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.0) or not (z <= 1.0): tmp = z * (x + y) else: tmp = x + y return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.0) || !(z <= 1.0)) tmp = Float64(z * Float64(x + y)); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -1.0) || ~((z <= 1.0))) tmp = z * (x + y); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.0], N[Not[LessEqual[z, 1.0]], $MachinePrecision]], N[(z * N[(x + y), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \lor \neg \left(z \leq 1\right):\\
\;\;\;\;z \cdot \left(x + y\right)\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if z < -1 or 1 < z Initial program 100.0%
Taylor expanded in z around inf 96.5%
if -1 < z < 1Initial program 100.0%
Taylor expanded in z around 0 96.3%
Final simplification96.4%
(FPCore (x y z) :precision binary64 (if (<= x -5.2e-187) (* x (+ z 1.0)) (* y (+ z 1.0))))
double code(double x, double y, double z) {
double tmp;
if (x <= -5.2e-187) {
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 <= (-5.2d-187)) 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 <= -5.2e-187) {
tmp = x * (z + 1.0);
} else {
tmp = y * (z + 1.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -5.2e-187: tmp = x * (z + 1.0) else: tmp = y * (z + 1.0) return tmp
function code(x, y, z) tmp = 0.0 if (x <= -5.2e-187) 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 <= -5.2e-187) tmp = x * (z + 1.0); else tmp = y * (z + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -5.2e-187], 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 \leq -5.2 \cdot 10^{-187}:\\
\;\;\;\;x \cdot \left(z + 1\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(z + 1\right)\\
\end{array}
\end{array}
if x < -5.1999999999999999e-187Initial program 100.0%
Taylor expanded in x around inf 68.3%
if -5.1999999999999999e-187 < x Initial program 100.0%
Taylor expanded in x around 0 57.7%
Final simplification61.8%
(FPCore (x y z) :precision binary64 (if (<= x -2.1e-208) x y))
double code(double x, double y, double z) {
double tmp;
if (x <= -2.1e-208) {
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 (x <= (-2.1d-208)) 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 (x <= -2.1e-208) {
tmp = x;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -2.1e-208: tmp = x else: tmp = y return tmp
function code(x, y, z) tmp = 0.0 if (x <= -2.1e-208) tmp = x; else tmp = y; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -2.1e-208) tmp = x; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -2.1e-208], x, y]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.1 \cdot 10^{-208}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if x < -2.10000000000000012e-208Initial program 100.0%
Taylor expanded in x around inf 67.4%
Taylor expanded in z around 0 38.6%
if -2.10000000000000012e-208 < x Initial program 100.0%
Taylor expanded in x around 0 57.5%
Taylor expanded in z around 0 25.8%
Final simplification30.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 x around inf 54.0%
Taylor expanded in z around 0 32.5%
Final simplification32.5%
herbie shell --seed 2023174
(FPCore (x y z)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, G"
:precision binary64
(* (+ x y) (+ z 1.0)))