
(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 10 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 (+ (* z (+ x y)) (+ x y)))
double code(double x, double y, double z) {
return (z * (x + y)) + (x + y);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (z * (x + y)) + (x + y)
end function
public static double code(double x, double y, double z) {
return (z * (x + y)) + (x + y);
}
def code(x, y, z): return (z * (x + y)) + (x + y)
function code(x, y, z) return Float64(Float64(z * Float64(x + y)) + Float64(x + y)) end
function tmp = code(x, y, z) tmp = (z * (x + y)) + (x + y); end
code[x_, y_, z_] := N[(N[(z * N[(x + y), $MachinePrecision]), $MachinePrecision] + N[(x + y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
z \cdot \left(x + y\right) + \left(x + y\right)
\end{array}
Initial program 100.0%
+-commutative100.0%
distribute-lft-in100.0%
*-rgt-identity100.0%
Applied egg-rr100.0%
Final simplification100.0%
(FPCore (x y z)
:precision binary64
(if (<= z -1.0)
(* x z)
(if (<= z -1.16e-58)
x
(if (<= z -1.22e-214)
y
(if (<= z 8.5e-82)
x
(if (<= z 1.36e-8) y (if (<= z 9e+157) (* y z) (* x z))))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.0) {
tmp = x * z;
} else if (z <= -1.16e-58) {
tmp = x;
} else if (z <= -1.22e-214) {
tmp = y;
} else if (z <= 8.5e-82) {
tmp = x;
} else if (z <= 1.36e-8) {
tmp = y;
} else if (z <= 9e+157) {
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 = x * z
else if (z <= (-1.16d-58)) then
tmp = x
else if (z <= (-1.22d-214)) then
tmp = y
else if (z <= 8.5d-82) then
tmp = x
else if (z <= 1.36d-8) then
tmp = y
else if (z <= 9d+157) 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 = x * z;
} else if (z <= -1.16e-58) {
tmp = x;
} else if (z <= -1.22e-214) {
tmp = y;
} else if (z <= 8.5e-82) {
tmp = x;
} else if (z <= 1.36e-8) {
tmp = y;
} else if (z <= 9e+157) {
tmp = y * z;
} else {
tmp = x * z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.0: tmp = x * z elif z <= -1.16e-58: tmp = x elif z <= -1.22e-214: tmp = y elif z <= 8.5e-82: tmp = x elif z <= 1.36e-8: tmp = y elif z <= 9e+157: tmp = y * z else: tmp = x * z return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.0) tmp = Float64(x * z); elseif (z <= -1.16e-58) tmp = x; elseif (z <= -1.22e-214) tmp = y; elseif (z <= 8.5e-82) tmp = x; elseif (z <= 1.36e-8) tmp = y; elseif (z <= 9e+157) 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 = x * z; elseif (z <= -1.16e-58) tmp = x; elseif (z <= -1.22e-214) tmp = y; elseif (z <= 8.5e-82) tmp = x; elseif (z <= 1.36e-8) tmp = y; elseif (z <= 9e+157) tmp = y * z; else tmp = x * z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.0], N[(x * z), $MachinePrecision], If[LessEqual[z, -1.16e-58], x, If[LessEqual[z, -1.22e-214], y, If[LessEqual[z, 8.5e-82], x, If[LessEqual[z, 1.36e-8], y, If[LessEqual[z, 9e+157], N[(y * z), $MachinePrecision], N[(x * z), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z \leq -1.16 \cdot 10^{-58}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq -1.22 \cdot 10^{-214}:\\
\;\;\;\;y\\
\mathbf{elif}\;z \leq 8.5 \cdot 10^{-82}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 1.36 \cdot 10^{-8}:\\
\;\;\;\;y\\
\mathbf{elif}\;z \leq 9 \cdot 10^{+157}:\\
\;\;\;\;y \cdot z\\
\mathbf{else}:\\
\;\;\;\;x \cdot z\\
\end{array}
\end{array}
if z < -1 or 8.9999999999999997e157 < z Initial program 100.0%
Taylor expanded in x around inf 44.5%
+-commutative44.5%
distribute-lft-in44.5%
*-rgt-identity44.5%
Applied egg-rr44.5%
Taylor expanded in z around inf 44.3%
if -1 < z < -1.16000000000000007e-58 or -1.22000000000000004e-214 < z < 8.4999999999999997e-82Initial program 100.0%
Taylor expanded in x around inf 52.0%
Taylor expanded in z around 0 49.9%
if -1.16000000000000007e-58 < z < -1.22000000000000004e-214 or 8.4999999999999997e-82 < z < 1.3599999999999999e-8Initial program 99.9%
Taylor expanded in x around 0 52.5%
Taylor expanded in z around 0 51.5%
if 1.3599999999999999e-8 < z < 8.9999999999999997e157Initial program 100.0%
Taylor expanded in x around 0 58.4%
+-commutative58.4%
distribute-lft-in58.4%
*-rgt-identity58.4%
Applied egg-rr58.4%
Taylor expanded in z around inf 46.8%
*-commutative46.8%
Simplified46.8%
Final simplification47.5%
(FPCore (x y z)
:precision binary64
(if (<= z -1.0)
(* x z)
(if (<= z -1.35e-58)
x
(if (<= z -5.4e-215)
y
(if (<= z 3.8e-82) x (if (<= z 1.36e-8) y (* x z)))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.0) {
tmp = x * z;
} else if (z <= -1.35e-58) {
tmp = x;
} else if (z <= -5.4e-215) {
tmp = y;
} else if (z <= 3.8e-82) {
tmp = x;
} else if (z <= 1.36e-8) {
tmp = y;
} 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 = x * z
else if (z <= (-1.35d-58)) then
tmp = x
else if (z <= (-5.4d-215)) then
tmp = y
else if (z <= 3.8d-82) then
tmp = x
else if (z <= 1.36d-8) then
tmp = y
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 = x * z;
} else if (z <= -1.35e-58) {
tmp = x;
} else if (z <= -5.4e-215) {
tmp = y;
} else if (z <= 3.8e-82) {
tmp = x;
} else if (z <= 1.36e-8) {
tmp = y;
} else {
tmp = x * z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.0: tmp = x * z elif z <= -1.35e-58: tmp = x elif z <= -5.4e-215: tmp = y elif z <= 3.8e-82: tmp = x elif z <= 1.36e-8: tmp = y else: tmp = x * z return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.0) tmp = Float64(x * z); elseif (z <= -1.35e-58) tmp = x; elseif (z <= -5.4e-215) tmp = y; elseif (z <= 3.8e-82) tmp = x; elseif (z <= 1.36e-8) tmp = y; else tmp = Float64(x * z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.0) tmp = x * z; elseif (z <= -1.35e-58) tmp = x; elseif (z <= -5.4e-215) tmp = y; elseif (z <= 3.8e-82) tmp = x; elseif (z <= 1.36e-8) tmp = y; else tmp = x * z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.0], N[(x * z), $MachinePrecision], If[LessEqual[z, -1.35e-58], x, If[LessEqual[z, -5.4e-215], y, If[LessEqual[z, 3.8e-82], x, If[LessEqual[z, 1.36e-8], y, N[(x * z), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z \leq -1.35 \cdot 10^{-58}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq -5.4 \cdot 10^{-215}:\\
\;\;\;\;y\\
\mathbf{elif}\;z \leq 3.8 \cdot 10^{-82}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 1.36 \cdot 10^{-8}:\\
\;\;\;\;y\\
\mathbf{else}:\\
\;\;\;\;x \cdot z\\
\end{array}
\end{array}
if z < -1 or 1.3599999999999999e-8 < z Initial program 100.0%
Taylor expanded in x around inf 44.3%
+-commutative44.3%
distribute-lft-in44.3%
*-rgt-identity44.3%
Applied egg-rr44.3%
Taylor expanded in z around inf 42.4%
if -1 < z < -1.3499999999999999e-58 or -5.40000000000000035e-215 < z < 3.8000000000000002e-82Initial program 100.0%
Taylor expanded in x around inf 52.0%
Taylor expanded in z around 0 49.9%
if -1.3499999999999999e-58 < z < -5.40000000000000035e-215 or 3.8000000000000002e-82 < z < 1.3599999999999999e-8Initial program 99.9%
Taylor expanded in x around 0 52.5%
Taylor expanded in z around 0 51.5%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (+ z 1.0))))
(if (<= z -1.5e-13)
t_0
(if (<= z 8.8e-10)
(+ x y)
(if (or (<= z 1.2e+45) (not (<= z 5.3e+157))) t_0 (* y z))))))
double code(double x, double y, double z) {
double t_0 = x * (z + 1.0);
double tmp;
if (z <= -1.5e-13) {
tmp = t_0;
} else if (z <= 8.8e-10) {
tmp = x + y;
} else if ((z <= 1.2e+45) || !(z <= 5.3e+157)) {
tmp = t_0;
} 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) :: t_0
real(8) :: tmp
t_0 = x * (z + 1.0d0)
if (z <= (-1.5d-13)) then
tmp = t_0
else if (z <= 8.8d-10) then
tmp = x + y
else if ((z <= 1.2d+45) .or. (.not. (z <= 5.3d+157))) then
tmp = t_0
else
tmp = y * z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x * (z + 1.0);
double tmp;
if (z <= -1.5e-13) {
tmp = t_0;
} else if (z <= 8.8e-10) {
tmp = x + y;
} else if ((z <= 1.2e+45) || !(z <= 5.3e+157)) {
tmp = t_0;
} else {
tmp = y * z;
}
return tmp;
}
def code(x, y, z): t_0 = x * (z + 1.0) tmp = 0 if z <= -1.5e-13: tmp = t_0 elif z <= 8.8e-10: tmp = x + y elif (z <= 1.2e+45) or not (z <= 5.3e+157): tmp = t_0 else: tmp = y * z return tmp
function code(x, y, z) t_0 = Float64(x * Float64(z + 1.0)) tmp = 0.0 if (z <= -1.5e-13) tmp = t_0; elseif (z <= 8.8e-10) tmp = Float64(x + y); elseif ((z <= 1.2e+45) || !(z <= 5.3e+157)) tmp = t_0; else tmp = Float64(y * z); end return tmp end
function tmp_2 = code(x, y, z) t_0 = x * (z + 1.0); tmp = 0.0; if (z <= -1.5e-13) tmp = t_0; elseif (z <= 8.8e-10) tmp = x + y; elseif ((z <= 1.2e+45) || ~((z <= 5.3e+157))) tmp = t_0; else tmp = y * z; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.5e-13], t$95$0, If[LessEqual[z, 8.8e-10], N[(x + y), $MachinePrecision], If[Or[LessEqual[z, 1.2e+45], N[Not[LessEqual[z, 5.3e+157]], $MachinePrecision]], t$95$0, N[(y * z), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(z + 1\right)\\
\mathbf{if}\;z \leq -1.5 \cdot 10^{-13}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 8.8 \cdot 10^{-10}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq 1.2 \cdot 10^{+45} \lor \neg \left(z \leq 5.3 \cdot 10^{+157}\right):\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;y \cdot z\\
\end{array}
\end{array}
if z < -1.49999999999999992e-13 or 8.7999999999999996e-10 < z < 1.19999999999999995e45 or 5.2999999999999998e157 < z Initial program 100.0%
Taylor expanded in x around inf 45.3%
if -1.49999999999999992e-13 < z < 8.7999999999999996e-10Initial program 100.0%
Taylor expanded in z around 0 99.3%
+-commutative99.3%
Simplified99.3%
if 1.19999999999999995e45 < z < 5.2999999999999998e157Initial program 100.0%
Taylor expanded in x around 0 60.8%
+-commutative60.8%
distribute-lft-in60.8%
*-rgt-identity60.8%
Applied egg-rr60.8%
Taylor expanded in z around inf 60.8%
*-commutative60.8%
Simplified60.8%
Final simplification71.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (+ x y))))
(if (<= z -1.0)
t_0
(if (<= z 2.3e-9) (+ x y) (if (<= z 32000000.0) (* x (+ z 1.0)) t_0)))))
double code(double x, double y, double z) {
double t_0 = z * (x + y);
double tmp;
if (z <= -1.0) {
tmp = t_0;
} else if (z <= 2.3e-9) {
tmp = x + y;
} else if (z <= 32000000.0) {
tmp = x * (z + 1.0);
} 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 = z * (x + y)
if (z <= (-1.0d0)) then
tmp = t_0
else if (z <= 2.3d-9) then
tmp = x + y
else if (z <= 32000000.0d0) then
tmp = x * (z + 1.0d0)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z * (x + y);
double tmp;
if (z <= -1.0) {
tmp = t_0;
} else if (z <= 2.3e-9) {
tmp = x + y;
} else if (z <= 32000000.0) {
tmp = x * (z + 1.0);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z * (x + y) tmp = 0 if z <= -1.0: tmp = t_0 elif z <= 2.3e-9: tmp = x + y elif z <= 32000000.0: tmp = x * (z + 1.0) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(z * Float64(x + y)) tmp = 0.0 if (z <= -1.0) tmp = t_0; elseif (z <= 2.3e-9) tmp = Float64(x + y); elseif (z <= 32000000.0) tmp = Float64(x * Float64(z + 1.0)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * (x + y); tmp = 0.0; if (z <= -1.0) tmp = t_0; elseif (z <= 2.3e-9) tmp = x + y; elseif (z <= 32000000.0) tmp = x * (z + 1.0); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[(x + y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.0], t$95$0, If[LessEqual[z, 2.3e-9], N[(x + y), $MachinePrecision], If[LessEqual[z, 32000000.0], N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \left(x + y\right)\\
\mathbf{if}\;z \leq -1:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 2.3 \cdot 10^{-9}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq 32000000:\\
\;\;\;\;x \cdot \left(z + 1\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -1 or 3.2e7 < z Initial program 100.0%
Taylor expanded in z around inf 98.7%
+-commutative98.7%
Simplified98.7%
if -1 < z < 2.2999999999999999e-9Initial program 100.0%
Taylor expanded in z around 0 98.0%
+-commutative98.0%
Simplified98.0%
if 2.2999999999999999e-9 < z < 3.2e7Initial program 99.8%
Taylor expanded in x around inf 43.2%
Final simplification96.9%
(FPCore (x y z) :precision binary64 (if (<= z -1.0) (* x z) (if (<= z 4500000.0) (+ x y) (if (<= z 8.6e+163) (* y z) (* x z)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.0) {
tmp = x * z;
} else if (z <= 4500000.0) {
tmp = x + y;
} else if (z <= 8.6e+163) {
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 = x * z
else if (z <= 4500000.0d0) then
tmp = x + y
else if (z <= 8.6d+163) 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 = x * z;
} else if (z <= 4500000.0) {
tmp = x + y;
} else if (z <= 8.6e+163) {
tmp = y * z;
} else {
tmp = x * z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.0: tmp = x * z elif z <= 4500000.0: tmp = x + y elif z <= 8.6e+163: tmp = y * z else: tmp = x * z return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.0) tmp = Float64(x * z); elseif (z <= 4500000.0) tmp = Float64(x + y); elseif (z <= 8.6e+163) 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 = x * z; elseif (z <= 4500000.0) tmp = x + y; elseif (z <= 8.6e+163) tmp = y * z; else tmp = x * z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.0], N[(x * z), $MachinePrecision], If[LessEqual[z, 4500000.0], N[(x + y), $MachinePrecision], If[LessEqual[z, 8.6e+163], N[(y * z), $MachinePrecision], N[(x * z), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z \leq 4500000:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq 8.6 \cdot 10^{+163}:\\
\;\;\;\;y \cdot z\\
\mathbf{else}:\\
\;\;\;\;x \cdot z\\
\end{array}
\end{array}
if z < -1 or 8.6000000000000004e163 < z Initial program 100.0%
Taylor expanded in x around inf 44.5%
+-commutative44.5%
distribute-lft-in44.5%
*-rgt-identity44.5%
Applied egg-rr44.5%
Taylor expanded in z around inf 44.3%
if -1 < z < 4.5e6Initial program 100.0%
Taylor expanded in z around 0 94.3%
+-commutative94.3%
Simplified94.3%
if 4.5e6 < z < 8.6000000000000004e163Initial program 100.0%
Taylor expanded in x around 0 58.7%
+-commutative58.7%
distribute-lft-in58.7%
*-rgt-identity58.7%
Applied egg-rr58.7%
Taylor expanded in z around inf 57.1%
*-commutative57.1%
Simplified57.1%
Final simplification70.2%
(FPCore (x y z) :precision binary64 (if (<= x -5.2e-179) (* x (+ z 1.0)) (* y (+ z 1.0))))
double code(double x, double y, double z) {
double tmp;
if (x <= -5.2e-179) {
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-179)) 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-179) {
tmp = x * (z + 1.0);
} else {
tmp = y * (z + 1.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -5.2e-179: 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-179) 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-179) 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-179], 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^{-179}:\\
\;\;\;\;x \cdot \left(z + 1\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(z + 1\right)\\
\end{array}
\end{array}
if x < -5.20000000000000011e-179Initial program 100.0%
Taylor expanded in x around inf 63.3%
if -5.20000000000000011e-179 < x Initial program 100.0%
Taylor expanded in x around 0 66.7%
Final simplification65.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 1.1e-63) x y))
double code(double x, double y, double z) {
double tmp;
if (y <= 1.1e-63) {
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 <= 1.1d-63) 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 <= 1.1e-63) {
tmp = x;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 1.1e-63: tmp = x else: tmp = y return tmp
function code(x, y, z) tmp = 0.0 if (y <= 1.1e-63) tmp = x; else tmp = y; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 1.1e-63) tmp = x; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 1.1e-63], x, y]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.1 \cdot 10^{-63}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if y < 1.1e-63Initial program 100.0%
Taylor expanded in x around inf 53.4%
Taylor expanded in z around 0 28.8%
if 1.1e-63 < y Initial program 100.0%
Taylor expanded in x around 0 72.2%
Taylor expanded in z around 0 36.4%
(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 47.0%
Taylor expanded in z around 0 24.4%
herbie shell --seed 2024091
(FPCore (x y z)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, G"
:precision binary64
(* (+ x y) (+ z 1.0)))