
(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
(let* ((t_1 (* y (- z t))))
(if (or (<= t_1 -1e+236) (not (<= t_1 4e+219)))
(- x (* y (/ (- z t) a)))
(+ x (/ (* y (- t z)) a)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = y * (z - t);
double tmp;
if ((t_1 <= -1e+236) || !(t_1 <= 4e+219)) {
tmp = x - (y * ((z - t) / a));
} else {
tmp = x + ((y * (t - z)) / a);
}
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 = y * (z - t)
if ((t_1 <= (-1d+236)) .or. (.not. (t_1 <= 4d+219))) then
tmp = x - (y * ((z - t) / a))
else
tmp = x + ((y * (t - z)) / a)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = y * (z - t);
double tmp;
if ((t_1 <= -1e+236) || !(t_1 <= 4e+219)) {
tmp = x - (y * ((z - t) / a));
} else {
tmp = x + ((y * (t - z)) / a);
}
return tmp;
}
def code(x, y, z, t, a): t_1 = y * (z - t) tmp = 0 if (t_1 <= -1e+236) or not (t_1 <= 4e+219): tmp = x - (y * ((z - t) / a)) else: tmp = x + ((y * (t - z)) / a) return tmp
function code(x, y, z, t, a) t_1 = Float64(y * Float64(z - t)) tmp = 0.0 if ((t_1 <= -1e+236) || !(t_1 <= 4e+219)) tmp = Float64(x - Float64(y * Float64(Float64(z - t) / a))); else tmp = Float64(x + Float64(Float64(y * Float64(t - z)) / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = y * (z - t); tmp = 0.0; if ((t_1 <= -1e+236) || ~((t_1 <= 4e+219))) tmp = x - (y * ((z - t) / a)); else tmp = x + ((y * (t - z)) / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -1e+236], N[Not[LessEqual[t$95$1, 4e+219]], $MachinePrecision]], N[(x - N[(y * N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y * N[(t - z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(z - t\right)\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+236} \lor \neg \left(t\_1 \leq 4 \cdot 10^{+219}\right):\\
\;\;\;\;x - y \cdot \frac{z - t}{a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot \left(t - z\right)}{a}\\
\end{array}
\end{array}
if (*.f64 y (-.f64 z t)) < -1.00000000000000005e236 or 3.99999999999999986e219 < (*.f64 y (-.f64 z t)) Initial program 74.2%
associate-/l*99.9%
Simplified99.9%
if -1.00000000000000005e236 < (*.f64 y (-.f64 z t)) < 3.99999999999999986e219Initial program 99.8%
Final simplification99.9%
(FPCore (x y z t a)
:precision binary64
(if (<= a -2.3e+32)
x
(if (<= a -3.2e-245)
(/ t (/ a y))
(if (<= a 2.15e-16) (/ (* y (- z)) a) x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -2.3e+32) {
tmp = x;
} else if (a <= -3.2e-245) {
tmp = t / (a / y);
} else if (a <= 2.15e-16) {
tmp = (y * -z) / a;
} 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 (a <= (-2.3d+32)) then
tmp = x
else if (a <= (-3.2d-245)) then
tmp = t / (a / y)
else if (a <= 2.15d-16) then
tmp = (y * -z) / a
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 (a <= -2.3e+32) {
tmp = x;
} else if (a <= -3.2e-245) {
tmp = t / (a / y);
} else if (a <= 2.15e-16) {
tmp = (y * -z) / a;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -2.3e+32: tmp = x elif a <= -3.2e-245: tmp = t / (a / y) elif a <= 2.15e-16: tmp = (y * -z) / a else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -2.3e+32) tmp = x; elseif (a <= -3.2e-245) tmp = Float64(t / Float64(a / y)); elseif (a <= 2.15e-16) tmp = Float64(Float64(y * Float64(-z)) / a); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -2.3e+32) tmp = x; elseif (a <= -3.2e-245) tmp = t / (a / y); elseif (a <= 2.15e-16) tmp = (y * -z) / a; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -2.3e+32], x, If[LessEqual[a, -3.2e-245], N[(t / N[(a / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 2.15e-16], N[(N[(y * (-z)), $MachinePrecision] / a), $MachinePrecision], x]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.3 \cdot 10^{+32}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq -3.2 \cdot 10^{-245}:\\
\;\;\;\;\frac{t}{\frac{a}{y}}\\
\mathbf{elif}\;a \leq 2.15 \cdot 10^{-16}:\\
\;\;\;\;\frac{y \cdot \left(-z\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -2.3e32 or 2.1499999999999999e-16 < a Initial program 85.9%
associate-/l*99.5%
Simplified99.5%
Taylor expanded in x around inf 58.8%
if -2.3e32 < a < -3.19999999999999986e-245Initial program 99.8%
associate-/l*82.7%
Simplified82.7%
Taylor expanded in z around 0 72.0%
associate-*r/72.0%
mul-1-neg72.0%
distribute-lft-neg-out72.0%
*-commutative72.0%
Simplified72.0%
Taylor expanded in x around 0 50.1%
associate-*r/50.2%
Simplified50.2%
clear-num50.1%
un-div-inv50.2%
Applied egg-rr50.2%
if -3.19999999999999986e-245 < a < 2.1499999999999999e-16Initial program 99.9%
associate-/l*81.3%
Simplified81.3%
Taylor expanded in z around inf 56.5%
mul-1-neg56.5%
associate-/l*45.9%
distribute-rgt-neg-in45.9%
distribute-frac-neg245.9%
Simplified45.9%
distribute-frac-neg245.9%
distribute-frac-neg45.9%
associate-*r/56.5%
Applied egg-rr56.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -2.8e+22) (not (<= t 24000000000000.0))) (+ x (/ t (/ a y))) (- x (* z (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -2.8e+22) || !(t <= 24000000000000.0)) {
tmp = x + (t / (a / y));
} else {
tmp = x - (z * (y / a));
}
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 <= (-2.8d+22)) .or. (.not. (t <= 24000000000000.0d0))) then
tmp = x + (t / (a / y))
else
tmp = x - (z * (y / a))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -2.8e+22) || !(t <= 24000000000000.0)) {
tmp = x + (t / (a / y));
} else {
tmp = x - (z * (y / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -2.8e+22) or not (t <= 24000000000000.0): tmp = x + (t / (a / y)) else: tmp = x - (z * (y / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -2.8e+22) || !(t <= 24000000000000.0)) tmp = Float64(x + Float64(t / Float64(a / y))); else tmp = Float64(x - Float64(z * Float64(y / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -2.8e+22) || ~((t <= 24000000000000.0))) tmp = x + (t / (a / y)); else tmp = x - (z * (y / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -2.8e+22], N[Not[LessEqual[t, 24000000000000.0]], $MachinePrecision]], N[(x + N[(t / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.8 \cdot 10^{+22} \lor \neg \left(t \leq 24000000000000\right):\\
\;\;\;\;x + \frac{t}{\frac{a}{y}}\\
\mathbf{else}:\\
\;\;\;\;x - z \cdot \frac{y}{a}\\
\end{array}
\end{array}
if t < -2.8e22 or 2.4e13 < t Initial program 89.1%
clear-num89.1%
associate-/r/89.1%
Applied egg-rr89.1%
Taylor expanded in z around 0 84.0%
mul-1-neg84.0%
distribute-lft-neg-out84.0%
*-commutative84.0%
Simplified84.0%
*-commutative84.0%
distribute-rgt-neg-out84.0%
cancel-sign-sub84.0%
div-inv84.0%
associate-*r/83.6%
+-commutative83.6%
frac-2neg83.6%
associate-*r/84.0%
*-commutative84.0%
distribute-lft-neg-out84.0%
frac-2neg84.0%
associate-*r/89.4%
clear-num89.4%
un-div-inv89.5%
Applied egg-rr89.5%
if -2.8e22 < t < 2.4e13Initial program 96.0%
associate-/l*92.6%
Simplified92.6%
Taylor expanded in z around inf 89.6%
*-commutative89.6%
associate-/l*93.4%
Applied egg-rr93.4%
Final simplification91.4%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -180000000.0) (not (<= t 3600000000000.0))) (+ x (/ t (/ a y))) (- x (* y (/ z a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -180000000.0) || !(t <= 3600000000000.0)) {
tmp = x + (t / (a / y));
} else {
tmp = x - (y * (z / a));
}
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 <= (-180000000.0d0)) .or. (.not. (t <= 3600000000000.0d0))) then
tmp = x + (t / (a / y))
else
tmp = x - (y * (z / a))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -180000000.0) || !(t <= 3600000000000.0)) {
tmp = x + (t / (a / y));
} else {
tmp = x - (y * (z / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -180000000.0) or not (t <= 3600000000000.0): tmp = x + (t / (a / y)) else: tmp = x - (y * (z / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -180000000.0) || !(t <= 3600000000000.0)) tmp = Float64(x + Float64(t / Float64(a / y))); else tmp = Float64(x - Float64(y * Float64(z / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -180000000.0) || ~((t <= 3600000000000.0))) tmp = x + (t / (a / y)); else tmp = x - (y * (z / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -180000000.0], N[Not[LessEqual[t, 3600000000000.0]], $MachinePrecision]], N[(x + N[(t / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -180000000 \lor \neg \left(t \leq 3600000000000\right):\\
\;\;\;\;x + \frac{t}{\frac{a}{y}}\\
\mathbf{else}:\\
\;\;\;\;x - y \cdot \frac{z}{a}\\
\end{array}
\end{array}
if t < -1.8e8 or 3.6e12 < t Initial program 89.3%
clear-num89.3%
associate-/r/89.2%
Applied egg-rr89.2%
Taylor expanded in z around 0 83.6%
mul-1-neg83.6%
distribute-lft-neg-out83.6%
*-commutative83.6%
Simplified83.6%
*-commutative83.6%
distribute-rgt-neg-out83.6%
cancel-sign-sub83.6%
div-inv83.6%
associate-*r/83.2%
+-commutative83.2%
frac-2neg83.2%
associate-*r/83.6%
*-commutative83.6%
distribute-lft-neg-out83.6%
frac-2neg83.6%
associate-*r/88.9%
clear-num88.8%
un-div-inv88.9%
Applied egg-rr88.9%
if -1.8e8 < t < 3.6e12Initial program 95.9%
associate-/l*93.2%
Simplified93.2%
Taylor expanded in z around inf 90.2%
associate-/l*87.9%
Simplified87.9%
Final simplification88.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.25e+153) (not (<= z 4.2e+104))) (* (/ y a) (- t z)) (+ x (/ t (/ a y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.25e+153) || !(z <= 4.2e+104)) {
tmp = (y / a) * (t - z);
} else {
tmp = x + (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 ((z <= (-1.25d+153)) .or. (.not. (z <= 4.2d+104))) then
tmp = (y / a) * (t - z)
else
tmp = x + (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 ((z <= -1.25e+153) || !(z <= 4.2e+104)) {
tmp = (y / a) * (t - z);
} else {
tmp = x + (t / (a / y));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.25e+153) or not (z <= 4.2e+104): tmp = (y / a) * (t - z) else: tmp = x + (t / (a / y)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.25e+153) || !(z <= 4.2e+104)) tmp = Float64(Float64(y / a) * Float64(t - z)); else tmp = Float64(x + Float64(t / Float64(a / y))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -1.25e+153) || ~((z <= 4.2e+104))) tmp = (y / a) * (t - z); else tmp = x + (t / (a / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.25e+153], N[Not[LessEqual[z, 4.2e+104]], $MachinePrecision]], N[(N[(y / a), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision], N[(x + N[(t / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.25 \cdot 10^{+153} \lor \neg \left(z \leq 4.2 \cdot 10^{+104}\right):\\
\;\;\;\;\frac{y}{a} \cdot \left(t - z\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{t}{\frac{a}{y}}\\
\end{array}
\end{array}
if z < -1.25000000000000005e153 or 4.1999999999999997e104 < z Initial program 86.3%
associate-/l*86.4%
Simplified86.4%
Taylor expanded in x around 0 72.6%
associate-*r/72.6%
neg-mul-172.6%
*-commutative72.6%
distribute-lft-neg-in72.6%
associate-*r/79.7%
*-commutative79.7%
neg-sub079.7%
sub-neg79.7%
+-commutative79.7%
associate--r+79.7%
neg-sub079.7%
remove-double-neg79.7%
Simplified79.7%
if -1.25000000000000005e153 < z < 4.1999999999999997e104Initial program 95.0%
clear-num95.0%
associate-/r/95.0%
Applied egg-rr95.0%
Taylor expanded in z around 0 83.0%
mul-1-neg83.0%
distribute-lft-neg-out83.0%
*-commutative83.0%
Simplified83.0%
*-commutative83.0%
distribute-rgt-neg-out83.0%
cancel-sign-sub83.0%
div-inv83.0%
associate-*r/80.7%
+-commutative80.7%
frac-2neg80.7%
associate-*r/83.0%
*-commutative83.0%
distribute-lft-neg-out83.0%
frac-2neg83.0%
associate-*r/86.4%
clear-num86.3%
un-div-inv86.4%
Applied egg-rr86.4%
Final simplification84.4%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -2.1e+152) (not (<= z 8.8e+101))) (* (/ y a) (- t z)) (+ x (/ (* y t) a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -2.1e+152) || !(z <= 8.8e+101)) {
tmp = (y / a) * (t - z);
} else {
tmp = x + ((y * t) / a);
}
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 <= (-2.1d+152)) .or. (.not. (z <= 8.8d+101))) then
tmp = (y / a) * (t - z)
else
tmp = x + ((y * t) / a)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -2.1e+152) || !(z <= 8.8e+101)) {
tmp = (y / a) * (t - z);
} else {
tmp = x + ((y * t) / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -2.1e+152) or not (z <= 8.8e+101): tmp = (y / a) * (t - z) else: tmp = x + ((y * t) / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -2.1e+152) || !(z <= 8.8e+101)) tmp = Float64(Float64(y / a) * Float64(t - z)); else tmp = Float64(x + Float64(Float64(y * t) / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -2.1e+152) || ~((z <= 8.8e+101))) tmp = (y / a) * (t - z); else tmp = x + ((y * t) / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -2.1e+152], N[Not[LessEqual[z, 8.8e+101]], $MachinePrecision]], N[(N[(y / a), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.1 \cdot 10^{+152} \lor \neg \left(z \leq 8.8 \cdot 10^{+101}\right):\\
\;\;\;\;\frac{y}{a} \cdot \left(t - z\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot t}{a}\\
\end{array}
\end{array}
if z < -2.1000000000000002e152 or 8.8000000000000003e101 < z Initial program 86.5%
associate-/l*86.6%
Simplified86.6%
Taylor expanded in x around 0 72.9%
associate-*r/72.9%
neg-mul-172.9%
*-commutative72.9%
distribute-lft-neg-in72.9%
associate-*r/79.9%
*-commutative79.9%
neg-sub079.9%
sub-neg79.9%
+-commutative79.9%
associate--r+79.9%
neg-sub079.9%
remove-double-neg79.9%
Simplified79.9%
if -2.1000000000000002e152 < z < 8.8000000000000003e101Initial program 95.0%
associate-/l*93.3%
Simplified93.3%
Taylor expanded in z around 0 82.9%
associate-*r/82.9%
mul-1-neg82.9%
distribute-lft-neg-out82.9%
*-commutative82.9%
Simplified82.9%
Taylor expanded in y around 0 82.9%
Final simplification82.0%
(FPCore (x y z t a) :precision binary64 (if (<= x -5.1e+194) x (if (<= x 1.85e+50) (* (/ y a) (- t z)) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -5.1e+194) {
tmp = x;
} else if (x <= 1.85e+50) {
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 <= (-5.1d+194)) then
tmp = x
else if (x <= 1.85d+50) 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 <= -5.1e+194) {
tmp = x;
} else if (x <= 1.85e+50) {
tmp = (y / a) * (t - z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if x <= -5.1e+194: tmp = x elif x <= 1.85e+50: tmp = (y / a) * (t - z) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (x <= -5.1e+194) tmp = x; elseif (x <= 1.85e+50) 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 <= -5.1e+194) tmp = x; elseif (x <= 1.85e+50) tmp = (y / a) * (t - z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -5.1e+194], x, If[LessEqual[x, 1.85e+50], N[(N[(y / a), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.1 \cdot 10^{+194}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1.85 \cdot 10^{+50}:\\
\;\;\;\;\frac{y}{a} \cdot \left(t - z\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -5.1000000000000002e194 or 1.85e50 < x Initial program 91.5%
associate-/l*90.5%
Simplified90.5%
Taylor expanded in x around inf 78.0%
if -5.1000000000000002e194 < x < 1.85e50Initial program 92.8%
associate-/l*91.6%
Simplified91.6%
Taylor expanded in x around 0 70.9%
associate-*r/70.9%
neg-mul-170.9%
*-commutative70.9%
distribute-lft-neg-in70.9%
associate-*r/75.5%
*-commutative75.5%
neg-sub075.5%
sub-neg75.5%
+-commutative75.5%
associate--r+75.5%
neg-sub075.5%
remove-double-neg75.5%
Simplified75.5%
(FPCore (x y z t a) :precision binary64 (if (<= x -5.5e+173) x (if (<= x 1.8e+46) (/ t (/ a y)) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -5.5e+173) {
tmp = x;
} else if (x <= 1.8e+46) {
tmp = t / (a / y);
} 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 <= (-5.5d+173)) then
tmp = x
else if (x <= 1.8d+46) then
tmp = t / (a / y)
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 <= -5.5e+173) {
tmp = x;
} else if (x <= 1.8e+46) {
tmp = t / (a / y);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if x <= -5.5e+173: tmp = x elif x <= 1.8e+46: tmp = t / (a / y) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (x <= -5.5e+173) tmp = x; elseif (x <= 1.8e+46) tmp = Float64(t / Float64(a / y)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (x <= -5.5e+173) tmp = x; elseif (x <= 1.8e+46) tmp = t / (a / y); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -5.5e+173], x, If[LessEqual[x, 1.8e+46], N[(t / N[(a / y), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.5 \cdot 10^{+173}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1.8 \cdot 10^{+46}:\\
\;\;\;\;\frac{t}{\frac{a}{y}}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -5.50000000000000049e173 or 1.7999999999999999e46 < x Initial program 89.9%
associate-/l*91.1%
Simplified91.1%
Taylor expanded in x around inf 74.0%
if -5.50000000000000049e173 < x < 1.7999999999999999e46Initial program 93.7%
associate-/l*91.3%
Simplified91.3%
Taylor expanded in z around 0 65.5%
associate-*r/65.5%
mul-1-neg65.5%
distribute-lft-neg-out65.5%
*-commutative65.5%
Simplified65.5%
Taylor expanded in x around 0 43.0%
associate-*r/45.2%
Simplified45.2%
clear-num45.2%
un-div-inv45.2%
Applied egg-rr45.2%
(FPCore (x y z t a) :precision binary64 (if (<= x -7.6e+174) x (if (<= x 2.65e+45) (* t (/ y a)) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -7.6e+174) {
tmp = x;
} else if (x <= 2.65e+45) {
tmp = t * (y / a);
} 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 <= (-7.6d+174)) then
tmp = x
else if (x <= 2.65d+45) then
tmp = t * (y / a)
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 <= -7.6e+174) {
tmp = x;
} else if (x <= 2.65e+45) {
tmp = t * (y / a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if x <= -7.6e+174: tmp = x elif x <= 2.65e+45: tmp = t * (y / a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (x <= -7.6e+174) tmp = x; elseif (x <= 2.65e+45) tmp = Float64(t * Float64(y / a)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (x <= -7.6e+174) tmp = x; elseif (x <= 2.65e+45) tmp = t * (y / a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -7.6e+174], x, If[LessEqual[x, 2.65e+45], N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.6 \cdot 10^{+174}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 2.65 \cdot 10^{+45}:\\
\;\;\;\;t \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -7.6000000000000004e174 or 2.64999999999999996e45 < x Initial program 89.9%
associate-/l*91.1%
Simplified91.1%
Taylor expanded in x around inf 74.0%
if -7.6000000000000004e174 < x < 2.64999999999999996e45Initial program 93.7%
associate-/l*91.3%
Simplified91.3%
Taylor expanded in z around 0 65.5%
associate-*r/65.5%
mul-1-neg65.5%
distribute-lft-neg-out65.5%
*-commutative65.5%
Simplified65.5%
Taylor expanded in x around 0 43.0%
associate-*r/45.2%
Simplified45.2%
(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(y / Float64(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[(y / N[(a / N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y}{\frac{a}{t - z}}
\end{array}
Initial program 92.4%
associate-/l*91.3%
Simplified91.3%
clear-num91.0%
un-div-inv91.7%
Applied egg-rr91.7%
Final simplification91.7%
(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 92.4%
associate-/l*91.3%
Simplified91.3%
Final simplification91.3%
(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 92.4%
associate-/l*91.3%
Simplified91.3%
Taylor expanded in x around inf 41.3%
(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 2024143
(FPCore (x y z t a)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, F"
:precision binary64
:alt
(! :herbie-platform default (if (< y -430450648655599/4000000000000000000000000) (- x (/ 1 (/ (/ a (- z t)) y))) (if (< y 2894426862792089/10000000000000000000000000000000000000000000000000000000000000000) (- x (/ (* y (- z t)) a)) (- x (/ y (/ a (- z t)))))))
(- x (/ (* y (- z t)) a)))