
(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 (+ y (+ x (* (+ y x) z))))
double code(double x, double y, double z) {
return y + (x + ((y + x) * 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 + (x + ((y + x) * z))
end function
public static double code(double x, double y, double z) {
return y + (x + ((y + x) * z));
}
def code(x, y, z): return y + (x + ((y + x) * z))
function code(x, y, z) return Float64(y + Float64(x + Float64(Float64(y + x) * z))) end
function tmp = code(x, y, z) tmp = y + (x + ((y + x) * z)); end
code[x_, y_, z_] := N[(y + N[(x + N[(N[(y + x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y + \left(x + \left(y + x\right) \cdot z\right)
\end{array}
Initial program 100.0%
Taylor expanded in z around 0 100.0%
Final simplification100.0%
(FPCore (x y z)
:precision binary64
(if (<= z -1.2e+232)
(* y z)
(if (<= z -4.5e+180)
(* x z)
(if (<= z -1.02e+125)
(* y z)
(if (<= z -1.0)
(* x z)
(if (<= z 7e-6)
y
(if (or (<= z 7.2e+41)
(and (not (<= z 1.1e+130))
(or (<= z 3.8e+195)
(and (not (<= z 2.8e+257)) (<= z 6.8e+293)))))
(* x z)
(* y z))))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.2e+232) {
tmp = y * z;
} else if (z <= -4.5e+180) {
tmp = x * z;
} else if (z <= -1.02e+125) {
tmp = y * z;
} else if (z <= -1.0) {
tmp = x * z;
} else if (z <= 7e-6) {
tmp = y;
} else if ((z <= 7.2e+41) || (!(z <= 1.1e+130) && ((z <= 3.8e+195) || (!(z <= 2.8e+257) && (z <= 6.8e+293))))) {
tmp = x * z;
} 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.2d+232)) then
tmp = y * z
else if (z <= (-4.5d+180)) then
tmp = x * z
else if (z <= (-1.02d+125)) then
tmp = y * z
else if (z <= (-1.0d0)) then
tmp = x * z
else if (z <= 7d-6) then
tmp = y
else if ((z <= 7.2d+41) .or. (.not. (z <= 1.1d+130)) .and. (z <= 3.8d+195) .or. (.not. (z <= 2.8d+257)) .and. (z <= 6.8d+293)) then
tmp = x * z
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.2e+232) {
tmp = y * z;
} else if (z <= -4.5e+180) {
tmp = x * z;
} else if (z <= -1.02e+125) {
tmp = y * z;
} else if (z <= -1.0) {
tmp = x * z;
} else if (z <= 7e-6) {
tmp = y;
} else if ((z <= 7.2e+41) || (!(z <= 1.1e+130) && ((z <= 3.8e+195) || (!(z <= 2.8e+257) && (z <= 6.8e+293))))) {
tmp = x * z;
} else {
tmp = y * z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.2e+232: tmp = y * z elif z <= -4.5e+180: tmp = x * z elif z <= -1.02e+125: tmp = y * z elif z <= -1.0: tmp = x * z elif z <= 7e-6: tmp = y elif (z <= 7.2e+41) or (not (z <= 1.1e+130) and ((z <= 3.8e+195) or (not (z <= 2.8e+257) and (z <= 6.8e+293)))): tmp = x * z else: tmp = y * z return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.2e+232) tmp = Float64(y * z); elseif (z <= -4.5e+180) tmp = Float64(x * z); elseif (z <= -1.02e+125) tmp = Float64(y * z); elseif (z <= -1.0) tmp = Float64(x * z); elseif (z <= 7e-6) tmp = y; elseif ((z <= 7.2e+41) || (!(z <= 1.1e+130) && ((z <= 3.8e+195) || (!(z <= 2.8e+257) && (z <= 6.8e+293))))) tmp = Float64(x * z); else tmp = Float64(y * z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.2e+232) tmp = y * z; elseif (z <= -4.5e+180) tmp = x * z; elseif (z <= -1.02e+125) tmp = y * z; elseif (z <= -1.0) tmp = x * z; elseif (z <= 7e-6) tmp = y; elseif ((z <= 7.2e+41) || (~((z <= 1.1e+130)) && ((z <= 3.8e+195) || (~((z <= 2.8e+257)) && (z <= 6.8e+293))))) tmp = x * z; else tmp = y * z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.2e+232], N[(y * z), $MachinePrecision], If[LessEqual[z, -4.5e+180], N[(x * z), $MachinePrecision], If[LessEqual[z, -1.02e+125], N[(y * z), $MachinePrecision], If[LessEqual[z, -1.0], N[(x * z), $MachinePrecision], If[LessEqual[z, 7e-6], y, If[Or[LessEqual[z, 7.2e+41], And[N[Not[LessEqual[z, 1.1e+130]], $MachinePrecision], Or[LessEqual[z, 3.8e+195], And[N[Not[LessEqual[z, 2.8e+257]], $MachinePrecision], LessEqual[z, 6.8e+293]]]]], N[(x * z), $MachinePrecision], N[(y * z), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.2 \cdot 10^{+232}:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;z \leq -4.5 \cdot 10^{+180}:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z \leq -1.02 \cdot 10^{+125}:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;z \leq -1:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z \leq 7 \cdot 10^{-6}:\\
\;\;\;\;y\\
\mathbf{elif}\;z \leq 7.2 \cdot 10^{+41} \lor \neg \left(z \leq 1.1 \cdot 10^{+130}\right) \land \left(z \leq 3.8 \cdot 10^{+195} \lor \neg \left(z \leq 2.8 \cdot 10^{+257}\right) \land z \leq 6.8 \cdot 10^{+293}\right):\\
\;\;\;\;x \cdot z\\
\mathbf{else}:\\
\;\;\;\;y \cdot z\\
\end{array}
\end{array}
if z < -1.2000000000000001e232 or -4.49999999999999981e180 < z < -1.02e125 or 7.20000000000000051e41 < z < 1.09999999999999997e130 or 3.8e195 < z < 2.7999999999999998e257 or 6.8000000000000006e293 < z Initial program 100.0%
Taylor expanded in z around inf 100.0%
Taylor expanded in y around inf 50.1%
*-commutative50.1%
Simplified50.1%
if -1.2000000000000001e232 < z < -4.49999999999999981e180 or -1.02e125 < z < -1 or 6.99999999999999989e-6 < z < 7.20000000000000051e41 or 1.09999999999999997e130 < z < 3.8e195 or 2.7999999999999998e257 < z < 6.8000000000000006e293Initial program 100.0%
Taylor expanded in z around inf 94.5%
Taylor expanded in y around 0 48.4%
if -1 < z < 6.99999999999999989e-6Initial program 100.0%
Taylor expanded in x around 0 47.7%
Taylor expanded in z around 0 46.8%
Final simplification47.9%
(FPCore (x y z)
:precision binary64
(if (<= z -2e+226)
(* y z)
(if (<= z -2.8e+180)
(* x z)
(if (<= z -6.8e+124)
(* y z)
(if (<= z -1.0)
(* x z)
(if (<= z 9.5)
(+ y x)
(if (or (<= z 8.2e+41)
(and (not (<= z 1.8e+130))
(or (<= z 1.9e+205)
(and (not (<= z 4.4e+261)) (<= z 1.75e+295)))))
(* x z)
(* y z))))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -2e+226) {
tmp = y * z;
} else if (z <= -2.8e+180) {
tmp = x * z;
} else if (z <= -6.8e+124) {
tmp = y * z;
} else if (z <= -1.0) {
tmp = x * z;
} else if (z <= 9.5) {
tmp = y + x;
} else if ((z <= 8.2e+41) || (!(z <= 1.8e+130) && ((z <= 1.9e+205) || (!(z <= 4.4e+261) && (z <= 1.75e+295))))) {
tmp = x * z;
} 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 <= (-2d+226)) then
tmp = y * z
else if (z <= (-2.8d+180)) then
tmp = x * z
else if (z <= (-6.8d+124)) then
tmp = y * z
else if (z <= (-1.0d0)) then
tmp = x * z
else if (z <= 9.5d0) then
tmp = y + x
else if ((z <= 8.2d+41) .or. (.not. (z <= 1.8d+130)) .and. (z <= 1.9d+205) .or. (.not. (z <= 4.4d+261)) .and. (z <= 1.75d+295)) then
tmp = x * z
else
tmp = y * z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -2e+226) {
tmp = y * z;
} else if (z <= -2.8e+180) {
tmp = x * z;
} else if (z <= -6.8e+124) {
tmp = y * z;
} else if (z <= -1.0) {
tmp = x * z;
} else if (z <= 9.5) {
tmp = y + x;
} else if ((z <= 8.2e+41) || (!(z <= 1.8e+130) && ((z <= 1.9e+205) || (!(z <= 4.4e+261) && (z <= 1.75e+295))))) {
tmp = x * z;
} else {
tmp = y * z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -2e+226: tmp = y * z elif z <= -2.8e+180: tmp = x * z elif z <= -6.8e+124: tmp = y * z elif z <= -1.0: tmp = x * z elif z <= 9.5: tmp = y + x elif (z <= 8.2e+41) or (not (z <= 1.8e+130) and ((z <= 1.9e+205) or (not (z <= 4.4e+261) and (z <= 1.75e+295)))): tmp = x * z else: tmp = y * z return tmp
function code(x, y, z) tmp = 0.0 if (z <= -2e+226) tmp = Float64(y * z); elseif (z <= -2.8e+180) tmp = Float64(x * z); elseif (z <= -6.8e+124) tmp = Float64(y * z); elseif (z <= -1.0) tmp = Float64(x * z); elseif (z <= 9.5) tmp = Float64(y + x); elseif ((z <= 8.2e+41) || (!(z <= 1.8e+130) && ((z <= 1.9e+205) || (!(z <= 4.4e+261) && (z <= 1.75e+295))))) tmp = Float64(x * z); else tmp = Float64(y * z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -2e+226) tmp = y * z; elseif (z <= -2.8e+180) tmp = x * z; elseif (z <= -6.8e+124) tmp = y * z; elseif (z <= -1.0) tmp = x * z; elseif (z <= 9.5) tmp = y + x; elseif ((z <= 8.2e+41) || (~((z <= 1.8e+130)) && ((z <= 1.9e+205) || (~((z <= 4.4e+261)) && (z <= 1.75e+295))))) tmp = x * z; else tmp = y * z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -2e+226], N[(y * z), $MachinePrecision], If[LessEqual[z, -2.8e+180], N[(x * z), $MachinePrecision], If[LessEqual[z, -6.8e+124], N[(y * z), $MachinePrecision], If[LessEqual[z, -1.0], N[(x * z), $MachinePrecision], If[LessEqual[z, 9.5], N[(y + x), $MachinePrecision], If[Or[LessEqual[z, 8.2e+41], And[N[Not[LessEqual[z, 1.8e+130]], $MachinePrecision], Or[LessEqual[z, 1.9e+205], And[N[Not[LessEqual[z, 4.4e+261]], $MachinePrecision], LessEqual[z, 1.75e+295]]]]], N[(x * z), $MachinePrecision], N[(y * z), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2 \cdot 10^{+226}:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;z \leq -2.8 \cdot 10^{+180}:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z \leq -6.8 \cdot 10^{+124}:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;z \leq -1:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z \leq 9.5:\\
\;\;\;\;y + x\\
\mathbf{elif}\;z \leq 8.2 \cdot 10^{+41} \lor \neg \left(z \leq 1.8 \cdot 10^{+130}\right) \land \left(z \leq 1.9 \cdot 10^{+205} \lor \neg \left(z \leq 4.4 \cdot 10^{+261}\right) \land z \leq 1.75 \cdot 10^{+295}\right):\\
\;\;\;\;x \cdot z\\
\mathbf{else}:\\
\;\;\;\;y \cdot z\\
\end{array}
\end{array}
if z < -1.99999999999999992e226 or -2.80000000000000012e180 < z < -6.8e124 or 8.2000000000000007e41 < z < 1.8000000000000001e130 or 1.9e205 < z < 4.39999999999999969e261 or 1.74999999999999997e295 < z Initial program 100.0%
Taylor expanded in z around inf 100.0%
Taylor expanded in y around inf 50.1%
*-commutative50.1%
Simplified50.1%
if -1.99999999999999992e226 < z < -2.80000000000000012e180 or -6.8e124 < z < -1 or 9.5 < z < 8.2000000000000007e41 or 1.8000000000000001e130 < z < 1.9e205 or 4.39999999999999969e261 < z < 1.74999999999999997e295Initial program 100.0%
Taylor expanded in z around inf 95.8%
Taylor expanded in y around 0 49.0%
if -1 < z < 9.5Initial program 100.0%
Taylor expanded in z around 0 98.3%
Final simplification76.0%
(FPCore (x y z)
:precision binary64
(if (<= z -5.5e+230)
(* y z)
(if (<= z -2.3e+180)
(* x z)
(if (<= z -1.02e+125)
(* y z)
(if (<= z -1.0)
(* x z)
(if (<= z 7.4)
(+ y x)
(if (<= z 4.5e+42)
(* x z)
(if (<= z 4e+129)
(* y (+ z 1.0))
(if (or (<= z 1.08e+204)
(and (not (<= z 1.55e+258)) (<= z 7e+294)))
(* x z)
(* y z))))))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -5.5e+230) {
tmp = y * z;
} else if (z <= -2.3e+180) {
tmp = x * z;
} else if (z <= -1.02e+125) {
tmp = y * z;
} else if (z <= -1.0) {
tmp = x * z;
} else if (z <= 7.4) {
tmp = y + x;
} else if (z <= 4.5e+42) {
tmp = x * z;
} else if (z <= 4e+129) {
tmp = y * (z + 1.0);
} else if ((z <= 1.08e+204) || (!(z <= 1.55e+258) && (z <= 7e+294))) {
tmp = x * z;
} 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 <= (-5.5d+230)) then
tmp = y * z
else if (z <= (-2.3d+180)) then
tmp = x * z
else if (z <= (-1.02d+125)) then
tmp = y * z
else if (z <= (-1.0d0)) then
tmp = x * z
else if (z <= 7.4d0) then
tmp = y + x
else if (z <= 4.5d+42) then
tmp = x * z
else if (z <= 4d+129) then
tmp = y * (z + 1.0d0)
else if ((z <= 1.08d+204) .or. (.not. (z <= 1.55d+258)) .and. (z <= 7d+294)) then
tmp = x * z
else
tmp = y * z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -5.5e+230) {
tmp = y * z;
} else if (z <= -2.3e+180) {
tmp = x * z;
} else if (z <= -1.02e+125) {
tmp = y * z;
} else if (z <= -1.0) {
tmp = x * z;
} else if (z <= 7.4) {
tmp = y + x;
} else if (z <= 4.5e+42) {
tmp = x * z;
} else if (z <= 4e+129) {
tmp = y * (z + 1.0);
} else if ((z <= 1.08e+204) || (!(z <= 1.55e+258) && (z <= 7e+294))) {
tmp = x * z;
} else {
tmp = y * z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -5.5e+230: tmp = y * z elif z <= -2.3e+180: tmp = x * z elif z <= -1.02e+125: tmp = y * z elif z <= -1.0: tmp = x * z elif z <= 7.4: tmp = y + x elif z <= 4.5e+42: tmp = x * z elif z <= 4e+129: tmp = y * (z + 1.0) elif (z <= 1.08e+204) or (not (z <= 1.55e+258) and (z <= 7e+294)): tmp = x * z else: tmp = y * z return tmp
function code(x, y, z) tmp = 0.0 if (z <= -5.5e+230) tmp = Float64(y * z); elseif (z <= -2.3e+180) tmp = Float64(x * z); elseif (z <= -1.02e+125) tmp = Float64(y * z); elseif (z <= -1.0) tmp = Float64(x * z); elseif (z <= 7.4) tmp = Float64(y + x); elseif (z <= 4.5e+42) tmp = Float64(x * z); elseif (z <= 4e+129) tmp = Float64(y * Float64(z + 1.0)); elseif ((z <= 1.08e+204) || (!(z <= 1.55e+258) && (z <= 7e+294))) tmp = Float64(x * z); else tmp = Float64(y * z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -5.5e+230) tmp = y * z; elseif (z <= -2.3e+180) tmp = x * z; elseif (z <= -1.02e+125) tmp = y * z; elseif (z <= -1.0) tmp = x * z; elseif (z <= 7.4) tmp = y + x; elseif (z <= 4.5e+42) tmp = x * z; elseif (z <= 4e+129) tmp = y * (z + 1.0); elseif ((z <= 1.08e+204) || (~((z <= 1.55e+258)) && (z <= 7e+294))) tmp = x * z; else tmp = y * z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -5.5e+230], N[(y * z), $MachinePrecision], If[LessEqual[z, -2.3e+180], N[(x * z), $MachinePrecision], If[LessEqual[z, -1.02e+125], N[(y * z), $MachinePrecision], If[LessEqual[z, -1.0], N[(x * z), $MachinePrecision], If[LessEqual[z, 7.4], N[(y + x), $MachinePrecision], If[LessEqual[z, 4.5e+42], N[(x * z), $MachinePrecision], If[LessEqual[z, 4e+129], N[(y * N[(z + 1.0), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, 1.08e+204], And[N[Not[LessEqual[z, 1.55e+258]], $MachinePrecision], LessEqual[z, 7e+294]]], N[(x * z), $MachinePrecision], N[(y * z), $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.5 \cdot 10^{+230}:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;z \leq -2.3 \cdot 10^{+180}:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z \leq -1.02 \cdot 10^{+125}:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;z \leq -1:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z \leq 7.4:\\
\;\;\;\;y + x\\
\mathbf{elif}\;z \leq 4.5 \cdot 10^{+42}:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z \leq 4 \cdot 10^{+129}:\\
\;\;\;\;y \cdot \left(z + 1\right)\\
\mathbf{elif}\;z \leq 1.08 \cdot 10^{+204} \lor \neg \left(z \leq 1.55 \cdot 10^{+258}\right) \land z \leq 7 \cdot 10^{+294}:\\
\;\;\;\;x \cdot z\\
\mathbf{else}:\\
\;\;\;\;y \cdot z\\
\end{array}
\end{array}
if z < -5.49999999999999979e230 or -2.2999999999999999e180 < z < -1.02e125 or 1.08e204 < z < 1.5499999999999999e258 or 7.0000000000000003e294 < z Initial program 100.0%
Taylor expanded in z around inf 100.0%
Taylor expanded in y around inf 38.9%
*-commutative38.9%
Simplified38.9%
if -5.49999999999999979e230 < z < -2.2999999999999999e180 or -1.02e125 < z < -1 or 7.4000000000000004 < z < 4.50000000000000012e42 or 4e129 < z < 1.08e204 or 1.5499999999999999e258 < z < 7.0000000000000003e294Initial program 100.0%
Taylor expanded in z around inf 95.8%
Taylor expanded in y around 0 49.0%
if -1 < z < 7.4000000000000004Initial program 100.0%
Taylor expanded in z around 0 98.3%
if 4.50000000000000012e42 < z < 4e129Initial program 100.0%
Taylor expanded in x around 0 76.0%
Final simplification76.0%
(FPCore (x y z) :precision binary64 (if (or (<= x -2.8e-30) (and (not (<= x -3.95e-112)) (<= x -2.2e-129))) (* x (+ z 1.0)) (* y (+ z 1.0))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -2.8e-30) || (!(x <= -3.95e-112) && (x <= -2.2e-129))) {
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 <= (-2.8d-30)) .or. (.not. (x <= (-3.95d-112))) .and. (x <= (-2.2d-129))) 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 <= -2.8e-30) || (!(x <= -3.95e-112) && (x <= -2.2e-129))) {
tmp = x * (z + 1.0);
} else {
tmp = y * (z + 1.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -2.8e-30) or (not (x <= -3.95e-112) and (x <= -2.2e-129)): tmp = x * (z + 1.0) else: tmp = y * (z + 1.0) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -2.8e-30) || (!(x <= -3.95e-112) && (x <= -2.2e-129))) 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 <= -2.8e-30) || (~((x <= -3.95e-112)) && (x <= -2.2e-129))) tmp = x * (z + 1.0); else tmp = y * (z + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -2.8e-30], And[N[Not[LessEqual[x, -3.95e-112]], $MachinePrecision], LessEqual[x, -2.2e-129]]], 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 -2.8 \cdot 10^{-30} \lor \neg \left(x \leq -3.95 \cdot 10^{-112}\right) \land x \leq -2.2 \cdot 10^{-129}:\\
\;\;\;\;x \cdot \left(z + 1\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(z + 1\right)\\
\end{array}
\end{array}
if x < -2.79999999999999988e-30 or -3.95e-112 < x < -2.20000000000000003e-129Initial program 100.0%
Taylor expanded in x around inf 74.9%
if -2.79999999999999988e-30 < x < -3.95e-112 or -2.20000000000000003e-129 < x Initial program 100.0%
Taylor expanded in x around 0 57.2%
Final simplification62.6%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.0) (not (<= z 1.0))) (* (+ y x) z) (+ y x)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.0) || !(z <= 1.0)) {
tmp = (y + x) * z;
} else {
tmp = y + x;
}
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 = (y + x) * z
else
tmp = y + x
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 = (y + x) * z;
} else {
tmp = y + x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.0) or not (z <= 1.0): tmp = (y + x) * z else: tmp = y + x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.0) || !(z <= 1.0)) tmp = Float64(Float64(y + x) * z); else tmp = Float64(y + x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -1.0) || ~((z <= 1.0))) tmp = (y + x) * z; else tmp = y + x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.0], N[Not[LessEqual[z, 1.0]], $MachinePrecision]], N[(N[(y + x), $MachinePrecision] * z), $MachinePrecision], N[(y + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \lor \neg \left(z \leq 1\right):\\
\;\;\;\;\left(y + x\right) \cdot z\\
\mathbf{else}:\\
\;\;\;\;y + x\\
\end{array}
\end{array}
if z < -1 or 1 < z Initial program 100.0%
Taylor expanded in z around inf 97.7%
if -1 < z < 1Initial program 100.0%
Taylor expanded in z around 0 98.3%
Final simplification98.0%
(FPCore (x y z) :precision binary64 (if (<= z -1.0) (* x z) (if (<= z 7e-6) y (* x z))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.0) {
tmp = x * z;
} else if (z <= 7e-6) {
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 <= 7d-6) 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 <= 7e-6) {
tmp = y;
} else {
tmp = x * z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.0: tmp = x * z elif z <= 7e-6: 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 <= 7e-6) 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 <= 7e-6) 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, 7e-6], y, N[(x * z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z \leq 7 \cdot 10^{-6}:\\
\;\;\;\;y\\
\mathbf{else}:\\
\;\;\;\;x \cdot z\\
\end{array}
\end{array}
if z < -1 or 6.99999999999999989e-6 < z Initial program 100.0%
Taylor expanded in z around inf 97.0%
Taylor expanded in y around 0 50.6%
if -1 < z < 6.99999999999999989e-6Initial program 100.0%
Taylor expanded in x around 0 47.7%
Taylor expanded in z around 0 46.8%
Final simplification48.6%
(FPCore (x y z) :precision binary64 (* (+ y x) (+ z 1.0)))
double code(double x, double y, double z) {
return (y + x) * (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 = (y + x) * (z + 1.0d0)
end function
public static double code(double x, double y, double z) {
return (y + x) * (z + 1.0);
}
def code(x, y, z): return (y + x) * (z + 1.0)
function code(x, y, z) return Float64(Float64(y + x) * Float64(z + 1.0)) end
function tmp = code(x, y, z) tmp = (y + x) * (z + 1.0); end
code[x_, y_, z_] := N[(N[(y + x), $MachinePrecision] * N[(z + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(y + x\right) \cdot \left(z + 1\right)
\end{array}
Initial program 100.0%
Final simplification100.0%
(FPCore (x y z) :precision binary64 y)
double code(double x, double y, double z) {
return y;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = y
end function
public static double code(double x, double y, double z) {
return y;
}
def code(x, y, z): return y
function code(x, y, z) return y end
function tmp = code(x, y, z) tmp = y; end
code[x_, y_, z_] := y
\begin{array}{l}
\\
y
\end{array}
Initial program 100.0%
Taylor expanded in x around 0 49.1%
Taylor expanded in z around 0 26.8%
Final simplification26.8%
herbie shell --seed 2023240
(FPCore (x y z)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, G"
:precision binary64
(* (+ x y) (+ z 1.0)))