
(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 10 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 (<= t_1 -5e+130)
(fma (/ y a) (- z t) x)
(if (<= t_1 5e+118) (+ x (/ t_1 a)) (+ x (/ (- z t) (/ a y)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = y * (z - t);
double tmp;
if (t_1 <= -5e+130) {
tmp = fma((y / a), (z - t), x);
} else if (t_1 <= 5e+118) {
tmp = x + (t_1 / a);
} else {
tmp = x + ((z - t) / (a / y));
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(y * Float64(z - t)) tmp = 0.0 if (t_1 <= -5e+130) tmp = fma(Float64(y / a), Float64(z - t), x); elseif (t_1 <= 5e+118) tmp = Float64(x + Float64(t_1 / a)); else tmp = Float64(x + Float64(Float64(z - t) / Float64(a / y))); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+130], N[(N[(y / a), $MachinePrecision] * N[(z - t), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t$95$1, 5e+118], N[(x + N[(t$95$1 / a), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(z - t), $MachinePrecision] / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(z - t\right)\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+130}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, z - t, x\right)\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+118}:\\
\;\;\;\;x + \frac{t\_1}{a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z - t}{\frac{a}{y}}\\
\end{array}
\end{array}
if (*.f64 y (-.f64 z t)) < -4.9999999999999996e130Initial program 90.8%
+-commutative90.8%
associate-*l/99.8%
fma-define99.8%
Simplified99.8%
if -4.9999999999999996e130 < (*.f64 y (-.f64 z t)) < 4.99999999999999972e118Initial program 98.5%
if 4.99999999999999972e118 < (*.f64 y (-.f64 z t)) Initial program 86.8%
+-commutative86.8%
associate-*l/99.9%
fma-define99.9%
Simplified99.9%
fma-undefine99.9%
*-commutative99.9%
clear-num99.9%
un-div-inv100.0%
Applied egg-rr100.0%
Final simplification99.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (/ z (/ a y)))) (t_2 (* y (- (/ t a)))))
(if (<= t -8.8e+110)
t_2
(if (<= t -1.45e+21)
t_1
(if (<= t -70.0)
t_2
(if (<= t -2.1e-276)
(+ x (/ (* y z) a))
(if (<= t 3.4e+15) t_1 t_2)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (z / (a / y));
double t_2 = y * -(t / a);
double tmp;
if (t <= -8.8e+110) {
tmp = t_2;
} else if (t <= -1.45e+21) {
tmp = t_1;
} else if (t <= -70.0) {
tmp = t_2;
} else if (t <= -2.1e-276) {
tmp = x + ((y * z) / a);
} else if (t <= 3.4e+15) {
tmp = t_1;
} else {
tmp = t_2;
}
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) :: t_2
real(8) :: tmp
t_1 = x + (z / (a / y))
t_2 = y * -(t / a)
if (t <= (-8.8d+110)) then
tmp = t_2
else if (t <= (-1.45d+21)) then
tmp = t_1
else if (t <= (-70.0d0)) then
tmp = t_2
else if (t <= (-2.1d-276)) then
tmp = x + ((y * z) / a)
else if (t <= 3.4d+15) then
tmp = t_1
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = x + (z / (a / y));
double t_2 = y * -(t / a);
double tmp;
if (t <= -8.8e+110) {
tmp = t_2;
} else if (t <= -1.45e+21) {
tmp = t_1;
} else if (t <= -70.0) {
tmp = t_2;
} else if (t <= -2.1e-276) {
tmp = x + ((y * z) / a);
} else if (t <= 3.4e+15) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + (z / (a / y)) t_2 = y * -(t / a) tmp = 0 if t <= -8.8e+110: tmp = t_2 elif t <= -1.45e+21: tmp = t_1 elif t <= -70.0: tmp = t_2 elif t <= -2.1e-276: tmp = x + ((y * z) / a) elif t <= 3.4e+15: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(z / Float64(a / y))) t_2 = Float64(y * Float64(-Float64(t / a))) tmp = 0.0 if (t <= -8.8e+110) tmp = t_2; elseif (t <= -1.45e+21) tmp = t_1; elseif (t <= -70.0) tmp = t_2; elseif (t <= -2.1e-276) tmp = Float64(x + Float64(Float64(y * z) / a)); elseif (t <= 3.4e+15) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + (z / (a / y)); t_2 = y * -(t / a); tmp = 0.0; if (t <= -8.8e+110) tmp = t_2; elseif (t <= -1.45e+21) tmp = t_1; elseif (t <= -70.0) tmp = t_2; elseif (t <= -2.1e-276) tmp = x + ((y * z) / a); elseif (t <= 3.4e+15) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(z / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(y * (-N[(t / a), $MachinePrecision])), $MachinePrecision]}, If[LessEqual[t, -8.8e+110], t$95$2, If[LessEqual[t, -1.45e+21], t$95$1, If[LessEqual[t, -70.0], t$95$2, If[LessEqual[t, -2.1e-276], N[(x + N[(N[(y * z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 3.4e+15], t$95$1, t$95$2]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{z}{\frac{a}{y}}\\
t_2 := y \cdot \left(-\frac{t}{a}\right)\\
\mathbf{if}\;t \leq -8.8 \cdot 10^{+110}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t \leq -1.45 \cdot 10^{+21}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -70:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t \leq -2.1 \cdot 10^{-276}:\\
\;\;\;\;x + \frac{y \cdot z}{a}\\
\mathbf{elif}\;t \leq 3.4 \cdot 10^{+15}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if t < -8.79999999999999967e110 or -1.45e21 < t < -70 or 3.4e15 < t Initial program 94.1%
+-commutative94.1%
associate-*l/96.1%
fma-define96.1%
Simplified96.1%
fma-undefine96.1%
*-commutative96.1%
clear-num96.0%
un-div-inv96.0%
Applied egg-rr96.0%
Taylor expanded in z around 0 83.2%
associate-*r/84.2%
neg-mul-184.2%
distribute-lft-neg-in84.2%
cancel-sign-sub-inv84.2%
associate-*r/83.2%
associate-/l*84.2%
Simplified84.2%
*-un-lft-identity84.2%
associate-*l/84.1%
clear-num84.2%
Applied egg-rr84.2%
Taylor expanded in x around 0 65.9%
mul-1-neg65.9%
associate-*r/65.1%
*-commutative65.1%
associate-*l/65.9%
associate-*r/61.3%
distribute-rgt-neg-in61.3%
distribute-neg-frac61.3%
Simplified61.3%
if -8.79999999999999967e110 < t < -1.45e21 or -2.1e-276 < t < 3.4e15Initial program 93.7%
associate-*l/96.9%
Simplified96.9%
Taylor expanded in z around inf 80.8%
associate-*l/85.8%
*-commutative85.8%
Simplified85.8%
clear-num85.7%
un-div-inv86.8%
Applied egg-rr86.8%
if -70 < t < -2.1e-276Initial program 96.5%
associate-*l/90.5%
Simplified90.5%
Taylor expanded in z around inf 85.3%
Final simplification76.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -9.8e+110) (not (<= t 3.4e+15))) (* y (- (/ t a))) (+ x (* z (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -9.8e+110) || !(t <= 3.4e+15)) {
tmp = y * -(t / a);
} 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 <= (-9.8d+110)) .or. (.not. (t <= 3.4d+15))) then
tmp = y * -(t / a)
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 <= -9.8e+110) || !(t <= 3.4e+15)) {
tmp = y * -(t / a);
} else {
tmp = x + (z * (y / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -9.8e+110) or not (t <= 3.4e+15): tmp = y * -(t / a) else: tmp = x + (z * (y / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -9.8e+110) || !(t <= 3.4e+15)) tmp = Float64(y * Float64(-Float64(t / a))); 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 <= -9.8e+110) || ~((t <= 3.4e+15))) tmp = y * -(t / a); else tmp = x + (z * (y / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -9.8e+110], N[Not[LessEqual[t, 3.4e+15]], $MachinePrecision]], N[(y * (-N[(t / a), $MachinePrecision])), $MachinePrecision], N[(x + N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -9.8 \cdot 10^{+110} \lor \neg \left(t \leq 3.4 \cdot 10^{+15}\right):\\
\;\;\;\;y \cdot \left(-\frac{t}{a}\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \frac{y}{a}\\
\end{array}
\end{array}
if t < -9.80000000000000003e110 or 3.4e15 < t Initial program 94.0%
+-commutative94.0%
associate-*l/96.0%
fma-define96.0%
Simplified96.0%
fma-undefine96.0%
*-commutative96.0%
clear-num95.9%
un-div-inv95.9%
Applied egg-rr95.9%
Taylor expanded in z around 0 82.6%
associate-*r/83.8%
neg-mul-183.8%
distribute-lft-neg-in83.8%
cancel-sign-sub-inv83.8%
associate-*r/82.6%
associate-/l*83.7%
Simplified83.7%
*-un-lft-identity83.7%
associate-*l/83.6%
clear-num83.8%
Applied egg-rr83.8%
Taylor expanded in x around 0 64.9%
mul-1-neg64.9%
associate-*r/64.1%
*-commutative64.1%
associate-*l/64.9%
associate-*r/60.2%
distribute-rgt-neg-in60.2%
distribute-neg-frac60.2%
Simplified60.2%
if -9.80000000000000003e110 < t < 3.4e15Initial program 94.9%
associate-*l/94.5%
Simplified94.5%
Taylor expanded in z around inf 81.0%
associate-*l/83.0%
*-commutative83.0%
Simplified83.0%
Final simplification74.1%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -8.5e+110) (not (<= t 3.35e+15))) (* y (- (/ t a))) (+ x (/ z (/ a y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -8.5e+110) || !(t <= 3.35e+15)) {
tmp = y * -(t / a);
} else {
tmp = x + (z / (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 <= (-8.5d+110)) .or. (.not. (t <= 3.35d+15))) then
tmp = y * -(t / a)
else
tmp = x + (z / (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 <= -8.5e+110) || !(t <= 3.35e+15)) {
tmp = y * -(t / a);
} else {
tmp = x + (z / (a / y));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -8.5e+110) or not (t <= 3.35e+15): tmp = y * -(t / a) else: tmp = x + (z / (a / y)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -8.5e+110) || !(t <= 3.35e+15)) tmp = Float64(y * Float64(-Float64(t / a))); else tmp = Float64(x + Float64(z / Float64(a / y))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -8.5e+110) || ~((t <= 3.35e+15))) tmp = y * -(t / a); else tmp = x + (z / (a / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -8.5e+110], N[Not[LessEqual[t, 3.35e+15]], $MachinePrecision]], N[(y * (-N[(t / a), $MachinePrecision])), $MachinePrecision], N[(x + N[(z / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -8.5 \cdot 10^{+110} \lor \neg \left(t \leq 3.35 \cdot 10^{+15}\right):\\
\;\;\;\;y \cdot \left(-\frac{t}{a}\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z}{\frac{a}{y}}\\
\end{array}
\end{array}
if t < -8.5000000000000004e110 or 3.35e15 < t Initial program 94.0%
+-commutative94.0%
associate-*l/96.0%
fma-define96.0%
Simplified96.0%
fma-undefine96.0%
*-commutative96.0%
clear-num95.9%
un-div-inv95.9%
Applied egg-rr95.9%
Taylor expanded in z around 0 82.6%
associate-*r/83.8%
neg-mul-183.8%
distribute-lft-neg-in83.8%
cancel-sign-sub-inv83.8%
associate-*r/82.6%
associate-/l*83.7%
Simplified83.7%
*-un-lft-identity83.7%
associate-*l/83.6%
clear-num83.8%
Applied egg-rr83.8%
Taylor expanded in x around 0 64.9%
mul-1-neg64.9%
associate-*r/64.1%
*-commutative64.1%
associate-*l/64.9%
associate-*r/60.2%
distribute-rgt-neg-in60.2%
distribute-neg-frac60.2%
Simplified60.2%
if -8.5000000000000004e110 < t < 3.35e15Initial program 94.9%
associate-*l/94.5%
Simplified94.5%
Taylor expanded in z around inf 81.0%
associate-*l/83.0%
*-commutative83.0%
Simplified83.0%
clear-num82.9%
un-div-inv83.6%
Applied egg-rr83.6%
Final simplification74.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -7.2) (not (<= t 19500000000000.0))) (- x (* t (/ y a))) (+ x (/ z (/ a y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -7.2) || !(t <= 19500000000000.0)) {
tmp = x - (t * (y / a));
} else {
tmp = x + (z / (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 <= (-7.2d0)) .or. (.not. (t <= 19500000000000.0d0))) then
tmp = x - (t * (y / a))
else
tmp = x + (z / (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 <= -7.2) || !(t <= 19500000000000.0)) {
tmp = x - (t * (y / a));
} else {
tmp = x + (z / (a / y));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -7.2) or not (t <= 19500000000000.0): tmp = x - (t * (y / a)) else: tmp = x + (z / (a / y)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -7.2) || !(t <= 19500000000000.0)) tmp = Float64(x - Float64(t * Float64(y / a))); else tmp = Float64(x + Float64(z / Float64(a / y))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -7.2) || ~((t <= 19500000000000.0))) tmp = x - (t * (y / a)); else tmp = x + (z / (a / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -7.2], N[Not[LessEqual[t, 19500000000000.0]], $MachinePrecision]], N[(x - N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -7.2 \lor \neg \left(t \leq 19500000000000\right):\\
\;\;\;\;x - t \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z}{\frac{a}{y}}\\
\end{array}
\end{array}
if t < -7.20000000000000018 or 1.95e13 < t Initial program 93.4%
+-commutative93.4%
associate-*l/96.6%
fma-define96.6%
Simplified96.6%
fma-undefine96.6%
*-commutative96.6%
clear-num96.5%
un-div-inv96.6%
Applied egg-rr96.6%
Taylor expanded in z around 0 80.2%
associate-*r/81.0%
neg-mul-181.0%
distribute-lft-neg-in81.0%
cancel-sign-sub-inv81.0%
associate-*r/80.2%
associate-/l*81.0%
Simplified81.0%
*-un-lft-identity81.0%
associate-*l/80.9%
clear-num81.0%
Applied egg-rr81.0%
if -7.20000000000000018 < t < 1.95e13Initial program 95.5%
associate-*l/93.6%
Simplified93.6%
Taylor expanded in z around inf 86.3%
associate-*l/87.2%
*-commutative87.2%
Simplified87.2%
clear-num87.1%
un-div-inv87.9%
Applied egg-rr87.9%
Final simplification84.7%
(FPCore (x y z t a) :precision binary64 (if (<= t -2000.0) (- x (* t (/ y a))) (if (<= t 1.4e+15) (+ x (/ z (/ a y))) (- x (/ (* y t) a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -2000.0) {
tmp = x - (t * (y / a));
} else if (t <= 1.4e+15) {
tmp = x + (z / (a / y));
} 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 (t <= (-2000.0d0)) then
tmp = x - (t * (y / a))
else if (t <= 1.4d+15) then
tmp = x + (z / (a / y))
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 (t <= -2000.0) {
tmp = x - (t * (y / a));
} else if (t <= 1.4e+15) {
tmp = x + (z / (a / y));
} else {
tmp = x - ((y * t) / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -2000.0: tmp = x - (t * (y / a)) elif t <= 1.4e+15: tmp = x + (z / (a / y)) else: tmp = x - ((y * t) / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -2000.0) tmp = Float64(x - Float64(t * Float64(y / a))); elseif (t <= 1.4e+15) tmp = Float64(x + Float64(z / Float64(a / y))); 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 (t <= -2000.0) tmp = x - (t * (y / a)); elseif (t <= 1.4e+15) tmp = x + (z / (a / y)); else tmp = x - ((y * t) / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -2000.0], N[(x - N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.4e+15], N[(x + N[(z / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(N[(y * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2000:\\
\;\;\;\;x - t \cdot \frac{y}{a}\\
\mathbf{elif}\;t \leq 1.4 \cdot 10^{+15}:\\
\;\;\;\;x + \frac{z}{\frac{a}{y}}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y \cdot t}{a}\\
\end{array}
\end{array}
if t < -2e3Initial program 89.8%
+-commutative89.8%
associate-*l/98.0%
fma-define98.0%
Simplified98.0%
fma-undefine98.0%
*-commutative98.0%
clear-num97.8%
un-div-inv98.0%
Applied egg-rr98.0%
Taylor expanded in z around 0 78.0%
associate-*r/82.9%
neg-mul-182.9%
distribute-lft-neg-in82.9%
cancel-sign-sub-inv82.9%
associate-*r/78.0%
associate-/l*82.9%
Simplified82.9%
*-un-lft-identity82.9%
associate-*l/82.8%
clear-num82.9%
Applied egg-rr82.9%
if -2e3 < t < 1.4e15Initial program 95.5%
associate-*l/93.6%
Simplified93.6%
Taylor expanded in z around inf 86.3%
associate-*l/87.2%
*-commutative87.2%
Simplified87.2%
clear-num87.1%
un-div-inv87.9%
Applied egg-rr87.9%
if 1.4e15 < t Initial program 96.8%
+-commutative96.8%
associate-*l/95.3%
fma-define95.3%
Simplified95.3%
fma-undefine95.3%
*-commutative95.3%
clear-num95.3%
un-div-inv95.4%
Applied egg-rr95.4%
Taylor expanded in z around 0 82.1%
associate-*r/79.3%
neg-mul-179.3%
distribute-lft-neg-in79.3%
cancel-sign-sub-inv79.3%
associate-*r/82.1%
associate-/l*79.3%
Simplified79.3%
Taylor expanded in t around 0 82.1%
Final simplification85.4%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -2.1e-12) (not (<= t 3.6e+14))) (* y (- (/ t a))) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -2.1e-12) || !(t <= 3.6e+14)) {
tmp = y * -(t / 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 ((t <= (-2.1d-12)) .or. (.not. (t <= 3.6d+14))) then
tmp = y * -(t / 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 ((t <= -2.1e-12) || !(t <= 3.6e+14)) {
tmp = y * -(t / a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -2.1e-12) or not (t <= 3.6e+14): tmp = y * -(t / a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -2.1e-12) || !(t <= 3.6e+14)) tmp = Float64(y * Float64(-Float64(t / a))); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -2.1e-12) || ~((t <= 3.6e+14))) tmp = y * -(t / a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -2.1e-12], N[Not[LessEqual[t, 3.6e+14]], $MachinePrecision]], N[(y * (-N[(t / a), $MachinePrecision])), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.1 \cdot 10^{-12} \lor \neg \left(t \leq 3.6 \cdot 10^{+14}\right):\\
\;\;\;\;y \cdot \left(-\frac{t}{a}\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -2.09999999999999994e-12 or 3.6e14 < t Initial program 93.5%
+-commutative93.5%
associate-*l/96.7%
fma-define96.7%
Simplified96.7%
fma-undefine96.7%
*-commutative96.7%
clear-num96.6%
un-div-inv96.7%
Applied egg-rr96.7%
Taylor expanded in z around 0 79.7%
associate-*r/80.6%
neg-mul-180.6%
distribute-lft-neg-in80.6%
cancel-sign-sub-inv80.6%
associate-*r/79.7%
associate-/l*80.6%
Simplified80.6%
*-un-lft-identity80.6%
associate-*l/80.5%
clear-num80.6%
Applied egg-rr80.6%
Taylor expanded in x around 0 61.3%
mul-1-neg61.3%
associate-*r/60.7%
*-commutative60.7%
associate-*l/61.3%
associate-*r/57.5%
distribute-rgt-neg-in57.5%
distribute-neg-frac57.5%
Simplified57.5%
if -2.09999999999999994e-12 < t < 3.6e14Initial program 95.5%
associate-*l/93.6%
Simplified93.6%
Taylor expanded in x around inf 48.1%
Final simplification52.6%
(FPCore (x y z t a) :precision binary64 (if (<= y -5e-24) (+ x (/ y (/ a (- z t)))) (+ x (/ (* y (- z t)) a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -5e-24) {
tmp = x + (y / (a / (z - t)));
} else {
tmp = x + ((y * (z - 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 (y <= (-5d-24)) then
tmp = x + (y / (a / (z - t)))
else
tmp = x + ((y * (z - 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 (y <= -5e-24) {
tmp = x + (y / (a / (z - t)));
} else {
tmp = x + ((y * (z - t)) / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if y <= -5e-24: tmp = x + (y / (a / (z - t))) else: tmp = x + ((y * (z - t)) / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (y <= -5e-24) tmp = Float64(x + Float64(y / Float64(a / Float64(z - t)))); else tmp = Float64(x + Float64(Float64(y * Float64(z - t)) / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (y <= -5e-24) tmp = x + (y / (a / (z - t))); else tmp = x + ((y * (z - t)) / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, -5e-24], N[(x + N[(y / N[(a / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5 \cdot 10^{-24}:\\
\;\;\;\;x + \frac{y}{\frac{a}{z - t}}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot \left(z - t\right)}{a}\\
\end{array}
\end{array}
if y < -4.9999999999999998e-24Initial program 88.8%
associate-*l/97.1%
Simplified97.1%
associate-/r/99.8%
Applied egg-rr99.8%
if -4.9999999999999998e-24 < y Initial program 96.7%
Final simplification97.5%
(FPCore (x y z t a) :precision binary64 (+ x (* (- z t) (/ y a))))
double code(double x, double y, double z, double t, double a) {
return x + ((z - t) * (y / 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 + ((z - t) * (y / a))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((z - t) * (y / a));
}
def code(x, y, z, t, a): return x + ((z - t) * (y / a))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(z - t) * Float64(y / a))) end
function tmp = code(x, y, z, t, a) tmp = x + ((z - t) * (y / a)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(z - t), $MachinePrecision] * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(z - t\right) \cdot \frac{y}{a}
\end{array}
Initial program 94.5%
associate-*l/95.0%
Simplified95.0%
Final simplification95.0%
(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 94.5%
associate-*l/95.0%
Simplified95.0%
Taylor expanded in x around inf 35.4%
Final simplification35.4%
(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 2024034
(FPCore (x y z t a)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, E"
: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)))