
(FPCore (x y z t a) :precision binary64 (- x (/ (* y (- z t)) a)))
double code(double x, double y, double z, double t, double a) {
return x - ((y * (z - t)) / a);
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x - ((y * (z - t)) / a)
end function
public static double code(double x, double y, double z, double t, double a) {
return x - ((y * (z - t)) / a);
}
def code(x, y, z, t, a): return x - ((y * (z - t)) / a)
function code(x, y, z, t, a) return Float64(x - Float64(Float64(y * Float64(z - t)) / a)) end
function tmp = code(x, y, z, t, a) tmp = x - ((y * (z - t)) / a); end
code[x_, y_, z_, t_, a_] := N[(x - N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{y \cdot \left(z - t\right)}{a}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (- x (/ (* y (- z t)) a)))
double code(double x, double y, double z, double t, double a) {
return x - ((y * (z - t)) / a);
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x - ((y * (z - t)) / a)
end function
public static double code(double x, double y, double z, double t, double a) {
return x - ((y * (z - t)) / a);
}
def code(x, y, z, t, a): return x - ((y * (z - t)) / a)
function code(x, y, z, t, a) return Float64(x - Float64(Float64(y * Float64(z - t)) / a)) end
function tmp = code(x, y, z, t, a) tmp = x - ((y * (z - t)) / a); end
code[x_, y_, z_, t_, a_] := N[(x - N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{y \cdot \left(z - t\right)}{a}
\end{array}
(FPCore (x y z t a) :precision binary64 (+ x (* (/ y a) (- t z))))
double code(double x, double y, double z, double t, double a) {
return x + ((y / a) * (t - z));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + ((y / a) * (t - z))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((y / a) * (t - z));
}
def code(x, y, z, t, a): return x + ((y / a) * (t - z))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(y / a) * Float64(t - z))) end
function tmp = code(x, y, z, t, a) tmp = x + ((y / a) * (t - z)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(y / a), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y}{a} \cdot \left(t - z\right)
\end{array}
Initial program 91.4%
associate-*l/97.9%
Simplified97.9%
Final simplification97.9%
(FPCore (x y z t a)
:precision binary64
(if (<= x -1.04e+123)
x
(if (<= x -8.5e-308)
(* z (/ y (- a)))
(if (<= x 1.25e-39)
(/ y (/ a t))
(if (<= x 8e+32) x (if (<= x 1.15e+109) (* (/ y a) t) x))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -1.04e+123) {
tmp = x;
} else if (x <= -8.5e-308) {
tmp = z * (y / -a);
} else if (x <= 1.25e-39) {
tmp = y / (a / t);
} else if (x <= 8e+32) {
tmp = x;
} else if (x <= 1.15e+109) {
tmp = (y / a) * t;
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (x <= (-1.04d+123)) then
tmp = x
else if (x <= (-8.5d-308)) then
tmp = z * (y / -a)
else if (x <= 1.25d-39) then
tmp = y / (a / t)
else if (x <= 8d+32) then
tmp = x
else if (x <= 1.15d+109) then
tmp = (y / a) * t
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -1.04e+123) {
tmp = x;
} else if (x <= -8.5e-308) {
tmp = z * (y / -a);
} else if (x <= 1.25e-39) {
tmp = y / (a / t);
} else if (x <= 8e+32) {
tmp = x;
} else if (x <= 1.15e+109) {
tmp = (y / a) * t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if x <= -1.04e+123: tmp = x elif x <= -8.5e-308: tmp = z * (y / -a) elif x <= 1.25e-39: tmp = y / (a / t) elif x <= 8e+32: tmp = x elif x <= 1.15e+109: tmp = (y / a) * t else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (x <= -1.04e+123) tmp = x; elseif (x <= -8.5e-308) tmp = Float64(z * Float64(y / Float64(-a))); elseif (x <= 1.25e-39) tmp = Float64(y / Float64(a / t)); elseif (x <= 8e+32) tmp = x; elseif (x <= 1.15e+109) tmp = Float64(Float64(y / a) * t); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (x <= -1.04e+123) tmp = x; elseif (x <= -8.5e-308) tmp = z * (y / -a); elseif (x <= 1.25e-39) tmp = y / (a / t); elseif (x <= 8e+32) tmp = x; elseif (x <= 1.15e+109) tmp = (y / a) * t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -1.04e+123], x, If[LessEqual[x, -8.5e-308], N[(z * N[(y / (-a)), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.25e-39], N[(y / N[(a / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 8e+32], x, If[LessEqual[x, 1.15e+109], N[(N[(y / a), $MachinePrecision] * t), $MachinePrecision], x]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.04 \cdot 10^{+123}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq -8.5 \cdot 10^{-308}:\\
\;\;\;\;z \cdot \frac{y}{-a}\\
\mathbf{elif}\;x \leq 1.25 \cdot 10^{-39}:\\
\;\;\;\;\frac{y}{\frac{a}{t}}\\
\mathbf{elif}\;x \leq 8 \cdot 10^{+32}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1.15 \cdot 10^{+109}:\\
\;\;\;\;\frac{y}{a} \cdot t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -1.04000000000000003e123 or 1.25e-39 < x < 8.00000000000000043e32 or 1.15000000000000005e109 < x Initial program 94.8%
associate-*r/94.8%
Simplified94.8%
Taylor expanded in x around inf 69.2%
if -1.04000000000000003e123 < x < -8.49999999999999972e-308Initial program 90.4%
associate-*r/90.3%
Simplified90.3%
Taylor expanded in z around inf 48.7%
mul-1-neg48.7%
associate-*l/56.7%
*-commutative56.7%
distribute-rgt-neg-in56.7%
distribute-frac-neg56.7%
*-lft-identity56.7%
metadata-eval56.7%
times-frac56.7%
neg-mul-156.7%
neg-mul-156.7%
remove-double-neg56.7%
Simplified56.7%
if -8.49999999999999972e-308 < x < 1.25e-39Initial program 89.4%
associate-*r/96.2%
Simplified96.2%
Taylor expanded in t around inf 53.0%
associate-/l*56.5%
Simplified56.5%
if 8.00000000000000043e32 < x < 1.15000000000000005e109Initial program 79.6%
associate-*r/79.5%
Simplified79.5%
Taylor expanded in t around inf 58.9%
associate-*l/72.3%
*-commutative72.3%
Simplified72.3%
Final simplification62.8%
(FPCore (x y z t a)
:precision binary64
(if (<= x -2.2e+125)
x
(if (or (<= x 9.5e-34) (and (not (<= x 1650000000.0)) (<= x 1.9e+112)))
(* (/ y a) (- t z))
x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -2.2e+125) {
tmp = x;
} else if ((x <= 9.5e-34) || (!(x <= 1650000000.0) && (x <= 1.9e+112))) {
tmp = (y / a) * (t - z);
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (x <= (-2.2d+125)) then
tmp = x
else if ((x <= 9.5d-34) .or. (.not. (x <= 1650000000.0d0)) .and. (x <= 1.9d+112)) then
tmp = (y / a) * (t - z)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -2.2e+125) {
tmp = x;
} else if ((x <= 9.5e-34) || (!(x <= 1650000000.0) && (x <= 1.9e+112))) {
tmp = (y / a) * (t - z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if x <= -2.2e+125: tmp = x elif (x <= 9.5e-34) or (not (x <= 1650000000.0) and (x <= 1.9e+112)): tmp = (y / a) * (t - z) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (x <= -2.2e+125) tmp = x; elseif ((x <= 9.5e-34) || (!(x <= 1650000000.0) && (x <= 1.9e+112))) tmp = Float64(Float64(y / a) * Float64(t - z)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (x <= -2.2e+125) tmp = x; elseif ((x <= 9.5e-34) || (~((x <= 1650000000.0)) && (x <= 1.9e+112))) tmp = (y / a) * (t - z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -2.2e+125], x, If[Or[LessEqual[x, 9.5e-34], And[N[Not[LessEqual[x, 1650000000.0]], $MachinePrecision], LessEqual[x, 1.9e+112]]], N[(N[(y / a), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.2 \cdot 10^{+125}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 9.5 \cdot 10^{-34} \lor \neg \left(x \leq 1650000000\right) \land x \leq 1.9 \cdot 10^{+112}:\\
\;\;\;\;\frac{y}{a} \cdot \left(t - z\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -2.19999999999999991e125 or 9.49999999999999985e-34 < x < 1.65e9 or 1.90000000000000004e112 < x Initial program 94.6%
associate-*r/94.6%
Simplified94.6%
Taylor expanded in x around inf 70.9%
if -2.19999999999999991e125 < x < 9.49999999999999985e-34 or 1.65e9 < x < 1.90000000000000004e112Initial program 89.3%
associate-*r/91.7%
Simplified91.7%
associate-*r/89.3%
associate-/l*92.0%
div-inv91.9%
associate-/r*96.4%
Applied egg-rr96.4%
Taylor expanded in x around 0 74.7%
mul-1-neg74.7%
*-commutative74.7%
neg-sub074.7%
*-commutative74.7%
associate-/l*76.7%
associate-/r/81.9%
sub-neg81.9%
distribute-lft-out73.3%
distribute-rgt-neg-in73.3%
unsub-neg73.3%
associate-+l-73.3%
neg-sub073.3%
distribute-rgt-neg-in73.3%
distribute-lft-in81.9%
+-commutative81.9%
unsub-neg81.9%
Simplified81.9%
Final simplification77.4%
(FPCore (x y z t a) :precision binary64 (if (or (<= x -1.02e+123) (not (<= x 4e-38))) (+ x (* (/ y a) t)) (* (/ y a) (- t z))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x <= -1.02e+123) || !(x <= 4e-38)) {
tmp = x + ((y / a) * t);
} else {
tmp = (y / a) * (t - z);
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((x <= (-1.02d+123)) .or. (.not. (x <= 4d-38))) then
tmp = x + ((y / a) * t)
else
tmp = (y / a) * (t - z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x <= -1.02e+123) || !(x <= 4e-38)) {
tmp = x + ((y / a) * t);
} else {
tmp = (y / a) * (t - z);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (x <= -1.02e+123) or not (x <= 4e-38): tmp = x + ((y / a) * t) else: tmp = (y / a) * (t - z) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((x <= -1.02e+123) || !(x <= 4e-38)) tmp = Float64(x + Float64(Float64(y / a) * t)); else tmp = Float64(Float64(y / a) * Float64(t - z)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((x <= -1.02e+123) || ~((x <= 4e-38))) tmp = x + ((y / a) * t); else tmp = (y / a) * (t - z); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[x, -1.02e+123], N[Not[LessEqual[x, 4e-38]], $MachinePrecision]], N[(x + N[(N[(y / a), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], N[(N[(y / a), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.02 \cdot 10^{+123} \lor \neg \left(x \leq 4 \cdot 10^{-38}\right):\\
\;\;\;\;x + \frac{y}{a} \cdot t\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a} \cdot \left(t - z\right)\\
\end{array}
\end{array}
if x < -1.02e123 or 3.9999999999999998e-38 < x Initial program 93.0%
associate-*r/93.0%
Simplified93.0%
Taylor expanded in z around 0 83.7%
cancel-sign-sub-inv83.7%
metadata-eval83.7%
*-lft-identity83.7%
+-commutative83.7%
associate-*l/89.1%
*-commutative89.1%
Simplified89.1%
if -1.02e123 < x < 3.9999999999999998e-38Initial program 90.0%
associate-*r/92.8%
Simplified92.8%
associate-*r/90.0%
associate-/l*92.9%
div-inv92.8%
associate-/r*96.0%
Applied egg-rr96.0%
Taylor expanded in x around 0 74.3%
mul-1-neg74.3%
*-commutative74.3%
neg-sub074.3%
*-commutative74.3%
associate-/l*77.0%
associate-/r/80.9%
sub-neg80.9%
distribute-lft-out73.5%
distribute-rgt-neg-in73.5%
unsub-neg73.5%
associate-+l-73.5%
neg-sub073.5%
distribute-rgt-neg-in73.5%
distribute-lft-in80.9%
+-commutative80.9%
unsub-neg80.9%
Simplified80.9%
Final simplification84.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.4e+88) (not (<= z 1.9e-40))) (- x (* y (/ z a))) (+ x (* (/ y a) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.4e+88) || !(z <= 1.9e-40)) {
tmp = x - (y * (z / a));
} else {
tmp = x + ((y / a) * t);
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((z <= (-1.4d+88)) .or. (.not. (z <= 1.9d-40))) then
tmp = x - (y * (z / a))
else
tmp = x + ((y / a) * t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.4e+88) || !(z <= 1.9e-40)) {
tmp = x - (y * (z / a));
} else {
tmp = x + ((y / a) * t);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.4e+88) or not (z <= 1.9e-40): tmp = x - (y * (z / a)) else: tmp = x + ((y / a) * t) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.4e+88) || !(z <= 1.9e-40)) tmp = Float64(x - Float64(y * Float64(z / a))); else tmp = Float64(x + Float64(Float64(y / a) * t)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -1.4e+88) || ~((z <= 1.9e-40))) tmp = x - (y * (z / a)); else tmp = x + ((y / a) * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.4e+88], N[Not[LessEqual[z, 1.9e-40]], $MachinePrecision]], N[(x - N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y / a), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.4 \cdot 10^{+88} \lor \neg \left(z \leq 1.9 \cdot 10^{-40}\right):\\
\;\;\;\;x - y \cdot \frac{z}{a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{a} \cdot t\\
\end{array}
\end{array}
if z < -1.39999999999999994e88 or 1.8999999999999999e-40 < z Initial program 87.4%
associate-*r/89.6%
Simplified89.6%
associate-*r/87.4%
associate-/l*89.9%
div-inv89.9%
associate-/r*97.4%
Applied egg-rr97.4%
Taylor expanded in z around inf 78.4%
associate-*r/80.6%
Simplified80.6%
if -1.39999999999999994e88 < z < 1.8999999999999999e-40Initial program 95.5%
associate-*r/96.2%
Simplified96.2%
Taylor expanded in z around 0 89.4%
cancel-sign-sub-inv89.4%
metadata-eval89.4%
*-lft-identity89.4%
+-commutative89.4%
associate-*l/92.3%
*-commutative92.3%
Simplified92.3%
Final simplification86.4%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.3e+88) (not (<= z 1.66e-40))) (- x (/ y (/ a z))) (+ x (* (/ y a) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.3e+88) || !(z <= 1.66e-40)) {
tmp = x - (y / (a / z));
} else {
tmp = x + ((y / a) * t);
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((z <= (-1.3d+88)) .or. (.not. (z <= 1.66d-40))) then
tmp = x - (y / (a / z))
else
tmp = x + ((y / a) * t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.3e+88) || !(z <= 1.66e-40)) {
tmp = x - (y / (a / z));
} else {
tmp = x + ((y / a) * t);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.3e+88) or not (z <= 1.66e-40): tmp = x - (y / (a / z)) else: tmp = x + ((y / a) * t) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.3e+88) || !(z <= 1.66e-40)) tmp = Float64(x - Float64(y / Float64(a / z))); else tmp = Float64(x + Float64(Float64(y / a) * t)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -1.3e+88) || ~((z <= 1.66e-40))) tmp = x - (y / (a / z)); else tmp = x + ((y / a) * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.3e+88], N[Not[LessEqual[z, 1.66e-40]], $MachinePrecision]], N[(x - N[(y / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y / a), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.3 \cdot 10^{+88} \lor \neg \left(z \leq 1.66 \cdot 10^{-40}\right):\\
\;\;\;\;x - \frac{y}{\frac{a}{z}}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{a} \cdot t\\
\end{array}
\end{array}
if z < -1.3e88 or 1.6600000000000001e-40 < z Initial program 87.4%
associate-/l*89.9%
Simplified89.9%
Taylor expanded in z around inf 80.7%
if -1.3e88 < z < 1.6600000000000001e-40Initial program 95.5%
associate-*r/96.2%
Simplified96.2%
Taylor expanded in z around 0 89.4%
cancel-sign-sub-inv89.4%
metadata-eval89.4%
*-lft-identity89.4%
+-commutative89.4%
associate-*l/92.3%
*-commutative92.3%
Simplified92.3%
Final simplification86.4%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.8e+26) (- x (/ (* y z) a)) (if (<= z 1.9e-40) (+ x (* (/ y a) t)) (- x (/ y (/ a z))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.8e+26) {
tmp = x - ((y * z) / a);
} else if (z <= 1.9e-40) {
tmp = x + ((y / a) * t);
} else {
tmp = x - (y / (a / z));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (z <= (-1.8d+26)) then
tmp = x - ((y * z) / a)
else if (z <= 1.9d-40) then
tmp = x + ((y / a) * t)
else
tmp = x - (y / (a / z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.8e+26) {
tmp = x - ((y * z) / a);
} else if (z <= 1.9e-40) {
tmp = x + ((y / a) * t);
} else {
tmp = x - (y / (a / z));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1.8e+26: tmp = x - ((y * z) / a) elif z <= 1.9e-40: tmp = x + ((y / a) * t) else: tmp = x - (y / (a / z)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.8e+26) tmp = Float64(x - Float64(Float64(y * z) / a)); elseif (z <= 1.9e-40) tmp = Float64(x + Float64(Float64(y / a) * t)); else tmp = Float64(x - Float64(y / Float64(a / z))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -1.8e+26) tmp = x - ((y * z) / a); elseif (z <= 1.9e-40) tmp = x + ((y / a) * t); else tmp = x - (y / (a / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.8e+26], N[(x - N[(N[(y * z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.9e-40], N[(x + N[(N[(y / a), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], N[(x - N[(y / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.8 \cdot 10^{+26}:\\
\;\;\;\;x - \frac{y \cdot z}{a}\\
\mathbf{elif}\;z \leq 1.9 \cdot 10^{-40}:\\
\;\;\;\;x + \frac{y}{a} \cdot t\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y}{\frac{a}{z}}\\
\end{array}
\end{array}
if z < -1.80000000000000012e26Initial program 90.8%
associate-*r/89.3%
Simplified89.3%
Taylor expanded in z around inf 83.0%
if -1.80000000000000012e26 < z < 1.8999999999999999e-40Initial program 95.1%
associate-*r/96.6%
Simplified96.6%
Taylor expanded in z around 0 90.1%
cancel-sign-sub-inv90.1%
metadata-eval90.1%
*-lft-identity90.1%
+-commutative90.1%
associate-*l/93.3%
*-commutative93.3%
Simplified93.3%
if 1.8999999999999999e-40 < z Initial program 86.4%
associate-/l*90.6%
Simplified90.6%
Taylor expanded in z around inf 80.4%
Final simplification86.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -2200000.0) (not (<= t 1.1e+20))) (* (/ y a) t) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -2200000.0) || !(t <= 1.1e+20)) {
tmp = (y / a) * t;
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((t <= (-2200000.0d0)) .or. (.not. (t <= 1.1d+20))) then
tmp = (y / a) * t
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -2200000.0) || !(t <= 1.1e+20)) {
tmp = (y / a) * t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -2200000.0) or not (t <= 1.1e+20): tmp = (y / a) * t else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -2200000.0) || !(t <= 1.1e+20)) tmp = Float64(Float64(y / a) * t); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -2200000.0) || ~((t <= 1.1e+20))) tmp = (y / a) * t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -2200000.0], N[Not[LessEqual[t, 1.1e+20]], $MachinePrecision]], N[(N[(y / a), $MachinePrecision] * t), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2200000 \lor \neg \left(t \leq 1.1 \cdot 10^{+20}\right):\\
\;\;\;\;\frac{y}{a} \cdot t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -2.2e6 or 1.1e20 < t Initial program 90.0%
associate-*r/90.8%
Simplified90.8%
Taylor expanded in t around inf 57.0%
associate-*l/60.6%
*-commutative60.6%
Simplified60.6%
if -2.2e6 < t < 1.1e20Initial program 92.7%
associate-*r/94.9%
Simplified94.9%
Taylor expanded in x around inf 51.6%
Final simplification56.0%
(FPCore (x y z t a) :precision binary64 (if (<= t -2800000.0) (* y (/ t a)) (if (<= t 1.05e+20) x (* (/ y a) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -2800000.0) {
tmp = y * (t / a);
} else if (t <= 1.05e+20) {
tmp = x;
} else {
tmp = (y / a) * t;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (t <= (-2800000.0d0)) then
tmp = y * (t / a)
else if (t <= 1.05d+20) then
tmp = x
else
tmp = (y / a) * t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -2800000.0) {
tmp = y * (t / a);
} else if (t <= 1.05e+20) {
tmp = x;
} else {
tmp = (y / a) * t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -2800000.0: tmp = y * (t / a) elif t <= 1.05e+20: tmp = x else: tmp = (y / a) * t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -2800000.0) tmp = Float64(y * Float64(t / a)); elseif (t <= 1.05e+20) tmp = x; else tmp = Float64(Float64(y / a) * t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -2800000.0) tmp = y * (t / a); elseif (t <= 1.05e+20) tmp = x; else tmp = (y / a) * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -2800000.0], N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.05e+20], x, N[(N[(y / a), $MachinePrecision] * t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2800000:\\
\;\;\;\;y \cdot \frac{t}{a}\\
\mathbf{elif}\;t \leq 1.05 \cdot 10^{+20}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a} \cdot t\\
\end{array}
\end{array}
if t < -2.8e6Initial program 93.7%
associate-*r/90.5%
Simplified90.5%
associate-*r/93.7%
associate-/l*90.6%
div-inv90.6%
associate-/r*96.8%
Applied egg-rr96.8%
Taylor expanded in t around inf 57.1%
associate-*r/58.5%
Simplified58.5%
if -2.8e6 < t < 1.05e20Initial program 92.7%
associate-*r/94.9%
Simplified94.9%
Taylor expanded in x around inf 51.6%
if 1.05e20 < t Initial program 86.4%
associate-*r/91.0%
Simplified91.0%
Taylor expanded in t around inf 56.8%
associate-*l/62.8%
*-commutative62.8%
Simplified62.8%
Final simplification56.0%
(FPCore (x y z t a) :precision binary64 (if (<= t -3000000.0) (* y (/ t a)) (if (<= t 1.05e+20) x (/ t (/ a y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -3000000.0) {
tmp = y * (t / a);
} else if (t <= 1.05e+20) {
tmp = x;
} else {
tmp = t / (a / y);
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (t <= (-3000000.0d0)) then
tmp = y * (t / a)
else if (t <= 1.05d+20) then
tmp = x
else
tmp = t / (a / y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -3000000.0) {
tmp = y * (t / a);
} else if (t <= 1.05e+20) {
tmp = x;
} else {
tmp = t / (a / y);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -3000000.0: tmp = y * (t / a) elif t <= 1.05e+20: tmp = x else: tmp = t / (a / y) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -3000000.0) tmp = Float64(y * Float64(t / a)); elseif (t <= 1.05e+20) tmp = x; else tmp = Float64(t / Float64(a / y)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -3000000.0) tmp = y * (t / a); elseif (t <= 1.05e+20) tmp = x; else tmp = t / (a / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -3000000.0], N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.05e+20], x, N[(t / N[(a / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3000000:\\
\;\;\;\;y \cdot \frac{t}{a}\\
\mathbf{elif}\;t \leq 1.05 \cdot 10^{+20}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{t}{\frac{a}{y}}\\
\end{array}
\end{array}
if t < -3e6Initial program 93.7%
associate-*r/90.5%
Simplified90.5%
associate-*r/93.7%
associate-/l*90.6%
div-inv90.6%
associate-/r*96.8%
Applied egg-rr96.8%
Taylor expanded in t around inf 57.1%
associate-*r/58.5%
Simplified58.5%
if -3e6 < t < 1.05e20Initial program 92.7%
associate-*r/94.9%
Simplified94.9%
Taylor expanded in x around inf 51.6%
if 1.05e20 < t Initial program 86.4%
associate-*r/91.0%
Simplified91.0%
Taylor expanded in t around inf 56.8%
associate-*l/62.8%
*-commutative62.8%
Simplified62.8%
clear-num62.7%
un-div-inv62.8%
Applied egg-rr62.8%
Final simplification56.0%
(FPCore (x y z t a) :precision binary64 (+ x (* y (/ (- t z) a))))
double code(double x, double y, double z, double t, double a) {
return x + (y * ((t - z) / a));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + (y * ((t - z) / a))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y * ((t - z) / a));
}
def code(x, y, z, t, a): return x + (y * ((t - z) / a))
function code(x, y, z, t, a) return Float64(x + Float64(y * Float64(Float64(t - z) / a))) end
function tmp = code(x, y, z, t, a) tmp = x + (y * ((t - z) / a)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y * N[(N[(t - z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \frac{t - z}{a}
\end{array}
Initial program 91.4%
associate-*r/92.9%
Simplified92.9%
Final simplification92.9%
(FPCore (x y z t a) :precision binary64 x)
double code(double x, double y, double z, double t, double a) {
return x;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x
end function
public static double code(double x, double y, double z, double t, double a) {
return x;
}
def code(x, y, z, t, a): return x
function code(x, y, z, t, a) return x end
function tmp = code(x, y, z, t, a) tmp = x; end
code[x_, y_, z_, t_, a_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 91.4%
associate-*r/92.9%
Simplified92.9%
Taylor expanded in x around inf 38.8%
Final simplification38.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ a (- z t))))
(if (< y -1.0761266216389975e-10)
(- x (/ 1.0 (/ t_1 y)))
(if (< y 2.894426862792089e-49)
(- x (/ (* y (- z t)) a))
(- x (/ y t_1))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = a / (z - t);
double tmp;
if (y < -1.0761266216389975e-10) {
tmp = x - (1.0 / (t_1 / y));
} else if (y < 2.894426862792089e-49) {
tmp = x - ((y * (z - t)) / a);
} else {
tmp = x - (y / t_1);
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = a / (z - t)
if (y < (-1.0761266216389975d-10)) then
tmp = x - (1.0d0 / (t_1 / y))
else if (y < 2.894426862792089d-49) then
tmp = x - ((y * (z - t)) / a)
else
tmp = x - (y / t_1)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = a / (z - t);
double tmp;
if (y < -1.0761266216389975e-10) {
tmp = x - (1.0 / (t_1 / y));
} else if (y < 2.894426862792089e-49) {
tmp = x - ((y * (z - t)) / a);
} else {
tmp = x - (y / t_1);
}
return tmp;
}
def code(x, y, z, t, a): t_1 = a / (z - t) tmp = 0 if y < -1.0761266216389975e-10: tmp = x - (1.0 / (t_1 / y)) elif y < 2.894426862792089e-49: tmp = x - ((y * (z - t)) / a) else: tmp = x - (y / t_1) return tmp
function code(x, y, z, t, a) t_1 = Float64(a / Float64(z - t)) tmp = 0.0 if (y < -1.0761266216389975e-10) tmp = Float64(x - Float64(1.0 / Float64(t_1 / y))); elseif (y < 2.894426862792089e-49) tmp = Float64(x - Float64(Float64(y * Float64(z - t)) / a)); else tmp = Float64(x - Float64(y / t_1)); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = a / (z - t); tmp = 0.0; if (y < -1.0761266216389975e-10) tmp = x - (1.0 / (t_1 / y)); elseif (y < 2.894426862792089e-49) tmp = x - ((y * (z - t)) / a); else tmp = x - (y / t_1); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(a / N[(z - t), $MachinePrecision]), $MachinePrecision]}, If[Less[y, -1.0761266216389975e-10], N[(x - N[(1.0 / N[(t$95$1 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Less[y, 2.894426862792089e-49], N[(x - N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(x - N[(y / t$95$1), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{a}{z - t}\\
\mathbf{if}\;y < -1.0761266216389975 \cdot 10^{-10}:\\
\;\;\;\;x - \frac{1}{\frac{t_1}{y}}\\
\mathbf{elif}\;y < 2.894426862792089 \cdot 10^{-49}:\\
\;\;\;\;x - \frac{y \cdot \left(z - t\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y}{t_1}\\
\end{array}
\end{array}
herbie shell --seed 2023262
(FPCore (x y z t a)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, F"
:precision binary64
:herbie-target
(if (< y -1.0761266216389975e-10) (- x (/ 1.0 (/ (/ a (- z t)) y))) (if (< y 2.894426862792089e-49) (- x (/ (* y (- z t)) a)) (- x (/ y (/ a (- z t))))))
(- x (/ (* y (- z t)) a)))