
(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 9 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 92.9%
associate-*l/97.5%
Simplified97.5%
Final simplification97.5%
(FPCore (x y z t a)
:precision binary64
(if (or (<= z -2.05e+194)
(not
(or (<= z 2.2e+101) (and (not (<= z 4.5e+138)) (<= z 1.6e+203)))))
(* (/ y a) (- z))
(+ x (* (/ y a) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -2.05e+194) || !((z <= 2.2e+101) || (!(z <= 4.5e+138) && (z <= 1.6e+203)))) {
tmp = (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 <= (-2.05d+194)) .or. (.not. (z <= 2.2d+101) .or. (.not. (z <= 4.5d+138)) .and. (z <= 1.6d+203))) then
tmp = (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 <= -2.05e+194) || !((z <= 2.2e+101) || (!(z <= 4.5e+138) && (z <= 1.6e+203)))) {
tmp = (y / a) * -z;
} else {
tmp = x + ((y / a) * t);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -2.05e+194) or not ((z <= 2.2e+101) or (not (z <= 4.5e+138) and (z <= 1.6e+203))): tmp = (y / a) * -z else: tmp = x + ((y / a) * t) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -2.05e+194) || !((z <= 2.2e+101) || (!(z <= 4.5e+138) && (z <= 1.6e+203)))) tmp = Float64(Float64(y / a) * Float64(-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 <= -2.05e+194) || ~(((z <= 2.2e+101) || (~((z <= 4.5e+138)) && (z <= 1.6e+203))))) tmp = (y / a) * -z; else tmp = x + ((y / a) * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -2.05e+194], N[Not[Or[LessEqual[z, 2.2e+101], And[N[Not[LessEqual[z, 4.5e+138]], $MachinePrecision], LessEqual[z, 1.6e+203]]]], $MachinePrecision]], N[(N[(y / a), $MachinePrecision] * (-z)), $MachinePrecision], N[(x + N[(N[(y / a), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.05 \cdot 10^{+194} \lor \neg \left(z \leq 2.2 \cdot 10^{+101} \lor \neg \left(z \leq 4.5 \cdot 10^{+138}\right) \land z \leq 1.6 \cdot 10^{+203}\right):\\
\;\;\;\;\frac{y}{a} \cdot \left(-z\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{a} \cdot t\\
\end{array}
\end{array}
if z < -2.05e194 or 2.2000000000000001e101 < z < 4.49999999999999982e138 or 1.5999999999999998e203 < z Initial program 90.0%
associate-*r/92.0%
Simplified92.0%
Taylor expanded in z around inf 79.7%
mul-1-neg79.7%
associate-*l/85.8%
*-commutative85.8%
distribute-rgt-neg-in85.8%
distribute-frac-neg85.8%
Simplified85.8%
if -2.05e194 < z < 2.2000000000000001e101 or 4.49999999999999982e138 < z < 1.5999999999999998e203Initial program 93.5%
associate-*r/95.7%
Simplified95.7%
Taylor expanded in z around 0 80.0%
sub-neg80.0%
mul-1-neg80.0%
remove-double-neg80.0%
+-commutative80.0%
associate-*l/83.8%
*-commutative83.8%
Simplified83.8%
Final simplification84.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* (/ y a) t))))
(if (<= t -5.5e+77)
t_1
(if (<= t -2.2e+17)
(* (/ y a) (- t z))
(if (<= t -7.2e-19)
(+ x (/ y (/ a t)))
(if (<= t 3.6e-18) (- x (* y (/ z a))) t_1))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + ((y / a) * t);
double tmp;
if (t <= -5.5e+77) {
tmp = t_1;
} else if (t <= -2.2e+17) {
tmp = (y / a) * (t - z);
} else if (t <= -7.2e-19) {
tmp = x + (y / (a / t));
} else if (t <= 3.6e-18) {
tmp = x - (y * (z / a));
} else {
tmp = 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 = x + ((y / a) * t)
if (t <= (-5.5d+77)) then
tmp = t_1
else if (t <= (-2.2d+17)) then
tmp = (y / a) * (t - z)
else if (t <= (-7.2d-19)) then
tmp = x + (y / (a / t))
else if (t <= 3.6d-18) then
tmp = x - (y * (z / a))
else
tmp = 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 = x + ((y / a) * t);
double tmp;
if (t <= -5.5e+77) {
tmp = t_1;
} else if (t <= -2.2e+17) {
tmp = (y / a) * (t - z);
} else if (t <= -7.2e-19) {
tmp = x + (y / (a / t));
} else if (t <= 3.6e-18) {
tmp = x - (y * (z / a));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + ((y / a) * t) tmp = 0 if t <= -5.5e+77: tmp = t_1 elif t <= -2.2e+17: tmp = (y / a) * (t - z) elif t <= -7.2e-19: tmp = x + (y / (a / t)) elif t <= 3.6e-18: tmp = x - (y * (z / a)) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(Float64(y / a) * t)) tmp = 0.0 if (t <= -5.5e+77) tmp = t_1; elseif (t <= -2.2e+17) tmp = Float64(Float64(y / a) * Float64(t - z)); elseif (t <= -7.2e-19) tmp = Float64(x + Float64(y / Float64(a / t))); elseif (t <= 3.6e-18) tmp = Float64(x - Float64(y * Float64(z / a))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + ((y / a) * t); tmp = 0.0; if (t <= -5.5e+77) tmp = t_1; elseif (t <= -2.2e+17) tmp = (y / a) * (t - z); elseif (t <= -7.2e-19) tmp = x + (y / (a / t)); elseif (t <= 3.6e-18) tmp = x - (y * (z / a)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(N[(y / a), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -5.5e+77], t$95$1, If[LessEqual[t, -2.2e+17], N[(N[(y / a), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, -7.2e-19], N[(x + N[(y / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 3.6e-18], N[(x - N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{y}{a} \cdot t\\
\mathbf{if}\;t \leq -5.5 \cdot 10^{+77}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq -2.2 \cdot 10^{+17}:\\
\;\;\;\;\frac{y}{a} \cdot \left(t - z\right)\\
\mathbf{elif}\;t \leq -7.2 \cdot 10^{-19}:\\
\;\;\;\;x + \frac{y}{\frac{a}{t}}\\
\mathbf{elif}\;t \leq 3.6 \cdot 10^{-18}:\\
\;\;\;\;x - y \cdot \frac{z}{a}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if t < -5.50000000000000036e77 or 3.6000000000000001e-18 < t Initial program 90.5%
associate-*r/92.7%
Simplified92.7%
Taylor expanded in z around 0 80.3%
sub-neg80.3%
mul-1-neg80.3%
remove-double-neg80.3%
+-commutative80.3%
associate-*l/88.6%
*-commutative88.6%
Simplified88.6%
if -5.50000000000000036e77 < t < -2.2e17Initial program 91.8%
associate-*r/99.7%
Simplified99.7%
Taylor expanded in x around 0 91.8%
associate-*l/99.9%
associate-*r*99.9%
neg-mul-199.9%
distribute-frac-neg99.9%
*-commutative99.9%
Simplified99.9%
if -2.2e17 < t < -7.2000000000000002e-19Initial program 99.7%
associate-*r/99.4%
Simplified99.4%
Taylor expanded in z around 0 95.8%
sub-neg95.8%
mul-1-neg95.8%
remove-double-neg95.8%
+-commutative95.8%
associate-*l/95.8%
*-commutative95.8%
Simplified95.8%
*-commutative95.8%
associate-/r/96.1%
Applied egg-rr96.1%
if -7.2000000000000002e-19 < t < 3.6000000000000001e-18Initial program 95.0%
associate-*r/96.7%
Simplified96.7%
Taylor expanded in z around inf 88.3%
Final simplification89.2%
(FPCore (x y z t a)
:precision binary64
(if (<= t -2.1e+18)
(* (/ y a) t)
(if (<= t -3.3e-235)
x
(if (<= t -2.6e-299)
(* (/ y a) (- z))
(if (<= t 1.5e+118) x (/ t (/ a y)))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -2.1e+18) {
tmp = (y / a) * t;
} else if (t <= -3.3e-235) {
tmp = x;
} else if (t <= -2.6e-299) {
tmp = (y / a) * -z;
} else if (t <= 1.5e+118) {
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 <= (-2.1d+18)) then
tmp = (y / a) * t
else if (t <= (-3.3d-235)) then
tmp = x
else if (t <= (-2.6d-299)) then
tmp = (y / a) * -z
else if (t <= 1.5d+118) 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 <= -2.1e+18) {
tmp = (y / a) * t;
} else if (t <= -3.3e-235) {
tmp = x;
} else if (t <= -2.6e-299) {
tmp = (y / a) * -z;
} else if (t <= 1.5e+118) {
tmp = x;
} else {
tmp = t / (a / y);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -2.1e+18: tmp = (y / a) * t elif t <= -3.3e-235: tmp = x elif t <= -2.6e-299: tmp = (y / a) * -z elif t <= 1.5e+118: tmp = x else: tmp = t / (a / y) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -2.1e+18) tmp = Float64(Float64(y / a) * t); elseif (t <= -3.3e-235) tmp = x; elseif (t <= -2.6e-299) tmp = Float64(Float64(y / a) * Float64(-z)); elseif (t <= 1.5e+118) 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 <= -2.1e+18) tmp = (y / a) * t; elseif (t <= -3.3e-235) tmp = x; elseif (t <= -2.6e-299) tmp = (y / a) * -z; elseif (t <= 1.5e+118) tmp = x; else tmp = t / (a / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -2.1e+18], N[(N[(y / a), $MachinePrecision] * t), $MachinePrecision], If[LessEqual[t, -3.3e-235], x, If[LessEqual[t, -2.6e-299], N[(N[(y / a), $MachinePrecision] * (-z)), $MachinePrecision], If[LessEqual[t, 1.5e+118], x, N[(t / N[(a / y), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.1 \cdot 10^{+18}:\\
\;\;\;\;\frac{y}{a} \cdot t\\
\mathbf{elif}\;t \leq -3.3 \cdot 10^{-235}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq -2.6 \cdot 10^{-299}:\\
\;\;\;\;\frac{y}{a} \cdot \left(-z\right)\\
\mathbf{elif}\;t \leq 1.5 \cdot 10^{+118}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{t}{\frac{a}{y}}\\
\end{array}
\end{array}
if t < -2.1e18Initial program 89.5%
associate-*r/93.4%
Simplified93.4%
Taylor expanded in t around inf 56.3%
associate-*l/65.0%
*-commutative65.0%
Simplified65.0%
if -2.1e18 < t < -3.30000000000000028e-235 or -2.5999999999999999e-299 < t < 1.5e118Initial program 96.4%
associate-*r/97.7%
Simplified97.7%
Taylor expanded in x around inf 49.9%
if -3.30000000000000028e-235 < t < -2.5999999999999999e-299Initial program 86.1%
associate-*r/86.7%
Simplified86.7%
Taylor expanded in z around inf 68.7%
mul-1-neg68.7%
associate-*l/82.4%
*-commutative82.4%
distribute-rgt-neg-in82.4%
distribute-frac-neg82.4%
Simplified82.4%
if 1.5e118 < t Initial program 87.8%
associate-*r/89.9%
Simplified89.9%
Taylor expanded in t around inf 59.1%
associate-*l/68.4%
*-commutative68.4%
Simplified68.4%
clear-num68.4%
un-div-inv68.4%
Applied egg-rr68.4%
Final simplification57.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -5.5e-22) (not (<= t 2.2e-20))) (+ x (* (/ y a) t)) (- x (* y (/ z a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -5.5e-22) || !(t <= 2.2e-20)) {
tmp = x + ((y / a) * t);
} 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 <= (-5.5d-22)) .or. (.not. (t <= 2.2d-20))) then
tmp = x + ((y / a) * t)
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 <= -5.5e-22) || !(t <= 2.2e-20)) {
tmp = x + ((y / a) * t);
} else {
tmp = x - (y * (z / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -5.5e-22) or not (t <= 2.2e-20): tmp = x + ((y / a) * t) else: tmp = x - (y * (z / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -5.5e-22) || !(t <= 2.2e-20)) tmp = Float64(x + Float64(Float64(y / a) * t)); 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 <= -5.5e-22) || ~((t <= 2.2e-20))) tmp = x + ((y / a) * t); else tmp = x - (y * (z / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -5.5e-22], N[Not[LessEqual[t, 2.2e-20]], $MachinePrecision]], N[(x + N[(N[(y / a), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], N[(x - N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5.5 \cdot 10^{-22} \lor \neg \left(t \leq 2.2 \cdot 10^{-20}\right):\\
\;\;\;\;x + \frac{y}{a} \cdot t\\
\mathbf{else}:\\
\;\;\;\;x - y \cdot \frac{z}{a}\\
\end{array}
\end{array}
if t < -5.5000000000000001e-22 or 2.19999999999999991e-20 < t Initial program 90.9%
associate-*r/93.6%
Simplified93.6%
Taylor expanded in z around 0 79.2%
sub-neg79.2%
mul-1-neg79.2%
remove-double-neg79.2%
+-commutative79.2%
associate-*l/86.5%
*-commutative86.5%
Simplified86.5%
if -5.5000000000000001e-22 < t < 2.19999999999999991e-20Initial program 95.0%
associate-*r/96.7%
Simplified96.7%
Taylor expanded in z around inf 88.3%
Final simplification87.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -1.4e+18) (not (<= t 3e+119))) (* (/ y a) t) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -1.4e+18) || !(t <= 3e+119)) {
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 <= (-1.4d+18)) .or. (.not. (t <= 3d+119))) 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 <= -1.4e+18) || !(t <= 3e+119)) {
tmp = (y / a) * t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -1.4e+18) or not (t <= 3e+119): tmp = (y / a) * t else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -1.4e+18) || !(t <= 3e+119)) 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 <= -1.4e+18) || ~((t <= 3e+119))) tmp = (y / a) * t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -1.4e+18], N[Not[LessEqual[t, 3e+119]], $MachinePrecision]], N[(N[(y / a), $MachinePrecision] * t), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.4 \cdot 10^{+18} \lor \neg \left(t \leq 3 \cdot 10^{+119}\right):\\
\;\;\;\;\frac{y}{a} \cdot t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -1.4e18 or 3.00000000000000001e119 < t Initial program 88.9%
associate-*r/92.2%
Simplified92.2%
Taylor expanded in t around inf 57.3%
associate-*l/66.2%
*-commutative66.2%
Simplified66.2%
if -1.4e18 < t < 3.00000000000000001e119Initial program 95.9%
associate-*r/97.2%
Simplified97.2%
Taylor expanded in x around inf 48.5%
Final simplification56.2%
(FPCore (x y z t a) :precision binary64 (if (<= t -2.5e+18) (* (/ y a) t) (if (<= t 1.4e+118) x (/ t (/ a y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -2.5e+18) {
tmp = (y / a) * t;
} else if (t <= 1.4e+118) {
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 <= (-2.5d+18)) then
tmp = (y / a) * t
else if (t <= 1.4d+118) 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 <= -2.5e+18) {
tmp = (y / a) * t;
} else if (t <= 1.4e+118) {
tmp = x;
} else {
tmp = t / (a / y);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -2.5e+18: tmp = (y / a) * t elif t <= 1.4e+118: tmp = x else: tmp = t / (a / y) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -2.5e+18) tmp = Float64(Float64(y / a) * t); elseif (t <= 1.4e+118) 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 <= -2.5e+18) tmp = (y / a) * t; elseif (t <= 1.4e+118) tmp = x; else tmp = t / (a / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -2.5e+18], N[(N[(y / a), $MachinePrecision] * t), $MachinePrecision], If[LessEqual[t, 1.4e+118], x, N[(t / N[(a / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.5 \cdot 10^{+18}:\\
\;\;\;\;\frac{y}{a} \cdot t\\
\mathbf{elif}\;t \leq 1.4 \cdot 10^{+118}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{t}{\frac{a}{y}}\\
\end{array}
\end{array}
if t < -2.5e18Initial program 89.5%
associate-*r/93.4%
Simplified93.4%
Taylor expanded in t around inf 56.3%
associate-*l/65.0%
*-commutative65.0%
Simplified65.0%
if -2.5e18 < t < 1.39999999999999993e118Initial program 95.9%
associate-*r/97.2%
Simplified97.2%
Taylor expanded in x around inf 48.5%
if 1.39999999999999993e118 < t Initial program 87.8%
associate-*r/89.9%
Simplified89.9%
Taylor expanded in t around inf 59.1%
associate-*l/68.4%
*-commutative68.4%
Simplified68.4%
clear-num68.4%
un-div-inv68.4%
Applied egg-rr68.4%
Final simplification56.2%
(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.9%
associate-*r/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 92.9%
associate-*r/95.0%
Simplified95.0%
Taylor expanded in x around inf 36.9%
Final simplification36.9%
(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 2023192
(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)))