
(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 11 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 (if (<= a -1e+23) (fma y (/ (- t z) a) x) (if (<= a 1.8e-5) (+ x (/ (* y (- t z)) a)) (+ x (/ y (/ a (- t z)))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -1e+23) {
tmp = fma(y, ((t - z) / a), x);
} else if (a <= 1.8e-5) {
tmp = x + ((y * (t - z)) / a);
} else {
tmp = x + (y / (a / (t - z)));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (a <= -1e+23) tmp = fma(y, Float64(Float64(t - z) / a), x); elseif (a <= 1.8e-5) tmp = Float64(x + Float64(Float64(y * Float64(t - z)) / a)); else tmp = Float64(x + Float64(y / Float64(a / Float64(t - z)))); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -1e+23], N[(y * N[(N[(t - z), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[a, 1.8e-5], N[(x + N[(N[(y * N[(t - z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / N[(a / N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1 \cdot 10^{+23}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t - z}{a}, x\right)\\
\mathbf{elif}\;a \leq 1.8 \cdot 10^{-5}:\\
\;\;\;\;x + \frac{y \cdot \left(t - z\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{a}{t - z}}\\
\end{array}
\end{array}
if a < -9.9999999999999992e22Initial program 78.9%
sub-neg78.9%
distribute-frac-neg278.9%
+-commutative78.9%
associate-/l*99.9%
fma-define99.9%
distribute-frac-neg299.9%
distribute-neg-frac99.9%
sub-neg99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
+-commutative99.9%
sub-neg99.9%
Simplified99.9%
if -9.9999999999999992e22 < a < 1.80000000000000005e-5Initial program 99.9%
if 1.80000000000000005e-5 < a Initial program 85.2%
associate-/l*99.9%
Simplified99.9%
clear-num99.8%
un-div-inv99.9%
Applied egg-rr99.9%
Final simplification99.9%
(FPCore (x y z t a)
:precision binary64
(if (<= a -3400000000.0)
x
(if (<= a 6.6e-117)
(* t (/ y a))
(if (<= a 1.35e-74) (* z (/ y (- a))) x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -3400000000.0) {
tmp = x;
} else if (a <= 6.6e-117) {
tmp = t * (y / a);
} else if (a <= 1.35e-74) {
tmp = z * (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 (a <= (-3400000000.0d0)) then
tmp = x
else if (a <= 6.6d-117) then
tmp = t * (y / a)
else if (a <= 1.35d-74) then
tmp = z * (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 (a <= -3400000000.0) {
tmp = x;
} else if (a <= 6.6e-117) {
tmp = t * (y / a);
} else if (a <= 1.35e-74) {
tmp = z * (y / -a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -3400000000.0: tmp = x elif a <= 6.6e-117: tmp = t * (y / a) elif a <= 1.35e-74: tmp = z * (y / -a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -3400000000.0) tmp = x; elseif (a <= 6.6e-117) tmp = Float64(t * Float64(y / a)); elseif (a <= 1.35e-74) tmp = Float64(z * Float64(y / Float64(-a))); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -3400000000.0) tmp = x; elseif (a <= 6.6e-117) tmp = t * (y / a); elseif (a <= 1.35e-74) tmp = z * (y / -a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -3400000000.0], x, If[LessEqual[a, 6.6e-117], N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 1.35e-74], N[(z * N[(y / (-a)), $MachinePrecision]), $MachinePrecision], x]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -3400000000:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 6.6 \cdot 10^{-117}:\\
\;\;\;\;t \cdot \frac{y}{a}\\
\mathbf{elif}\;a \leq 1.35 \cdot 10^{-74}:\\
\;\;\;\;z \cdot \frac{y}{-a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -3.4e9 or 1.35000000000000009e-74 < a Initial program 84.6%
associate-/l*99.2%
Simplified99.2%
Taylor expanded in x around inf 55.4%
if -3.4e9 < a < 6.6000000000000003e-117Initial program 99.9%
associate-/l*84.4%
Simplified84.4%
Taylor expanded in t around inf 60.1%
associate-/l*62.7%
Simplified62.7%
if 6.6000000000000003e-117 < a < 1.35000000000000009e-74Initial program 99.9%
clear-num99.9%
associate-/r/99.9%
Applied egg-rr99.9%
Taylor expanded in z around inf 81.9%
associate-*r/81.9%
neg-mul-181.9%
*-commutative81.9%
distribute-rgt-neg-in81.9%
associate-*r/81.9%
Simplified81.9%
Final simplification59.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -6.2e-171) (not (<= a 3.1e-84))) (+ x (/ y (/ a (- t z)))) (* (/ y a) (- t z))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -6.2e-171) || !(a <= 3.1e-84)) {
tmp = x + (y / (a / (t - z)));
} 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 ((a <= (-6.2d-171)) .or. (.not. (a <= 3.1d-84))) then
tmp = x + (y / (a / (t - z)))
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 ((a <= -6.2e-171) || !(a <= 3.1e-84)) {
tmp = x + (y / (a / (t - z)));
} else {
tmp = (y / a) * (t - z);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -6.2e-171) or not (a <= 3.1e-84): tmp = x + (y / (a / (t - z))) else: tmp = (y / a) * (t - z) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -6.2e-171) || !(a <= 3.1e-84)) tmp = Float64(x + Float64(y / Float64(a / Float64(t - z)))); 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 ((a <= -6.2e-171) || ~((a <= 3.1e-84))) tmp = x + (y / (a / (t - z))); else tmp = (y / a) * (t - z); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -6.2e-171], N[Not[LessEqual[a, 3.1e-84]], $MachinePrecision]], N[(x + N[(y / N[(a / N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y / a), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -6.2 \cdot 10^{-171} \lor \neg \left(a \leq 3.1 \cdot 10^{-84}\right):\\
\;\;\;\;x + \frac{y}{\frac{a}{t - z}}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a} \cdot \left(t - z\right)\\
\end{array}
\end{array}
if a < -6.2000000000000001e-171 or 3.10000000000000002e-84 < a Initial program 88.6%
associate-/l*97.8%
Simplified97.8%
clear-num97.8%
un-div-inv98.5%
Applied egg-rr98.5%
if -6.2000000000000001e-171 < a < 3.10000000000000002e-84Initial program 99.9%
associate-/l*77.5%
Simplified77.5%
Taylor expanded in x around 0 95.7%
mul-1-neg95.7%
associate-*l/93.2%
distribute-rgt-neg-in93.2%
sub-neg93.2%
distribute-neg-in93.2%
remove-double-neg93.2%
+-commutative93.2%
sub-neg93.2%
Simplified93.2%
Final simplification97.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -6.8e-171) (not (<= a 3.5e-86))) (+ x (* y (/ (- t z) a))) (* (/ y a) (- t z))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -6.8e-171) || !(a <= 3.5e-86)) {
tmp = x + (y * ((t - z) / a));
} 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 ((a <= (-6.8d-171)) .or. (.not. (a <= 3.5d-86))) then
tmp = x + (y * ((t - z) / a))
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 ((a <= -6.8e-171) || !(a <= 3.5e-86)) {
tmp = x + (y * ((t - z) / a));
} else {
tmp = (y / a) * (t - z);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -6.8e-171) or not (a <= 3.5e-86): tmp = x + (y * ((t - z) / a)) else: tmp = (y / a) * (t - z) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -6.8e-171) || !(a <= 3.5e-86)) tmp = Float64(x + Float64(y * Float64(Float64(t - z) / a))); 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 ((a <= -6.8e-171) || ~((a <= 3.5e-86))) tmp = x + (y * ((t - z) / a)); else tmp = (y / a) * (t - z); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -6.8e-171], N[Not[LessEqual[a, 3.5e-86]], $MachinePrecision]], N[(x + N[(y * N[(N[(t - z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y / a), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -6.8 \cdot 10^{-171} \lor \neg \left(a \leq 3.5 \cdot 10^{-86}\right):\\
\;\;\;\;x + y \cdot \frac{t - z}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a} \cdot \left(t - z\right)\\
\end{array}
\end{array}
if a < -6.7999999999999997e-171 or 3.50000000000000021e-86 < a Initial program 88.6%
associate-/l*97.8%
Simplified97.8%
if -6.7999999999999997e-171 < a < 3.50000000000000021e-86Initial program 99.9%
associate-/l*77.5%
Simplified77.5%
Taylor expanded in x around 0 95.7%
mul-1-neg95.7%
associate-*l/93.2%
distribute-rgt-neg-in93.2%
sub-neg93.2%
distribute-neg-in93.2%
remove-double-neg93.2%
+-commutative93.2%
sub-neg93.2%
Simplified93.2%
Final simplification96.6%
(FPCore (x y z t a) :precision binary64 (if (<= a -3e+17) (+ x (* y (/ (- t z) a))) (if (<= a 2e-9) (+ x (/ (* y (- t z)) a)) (+ x (/ y (/ a (- t z)))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -3e+17) {
tmp = x + (y * ((t - z) / a));
} else if (a <= 2e-9) {
tmp = x + ((y * (t - z)) / a);
} else {
tmp = x + (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 (a <= (-3d+17)) then
tmp = x + (y * ((t - z) / a))
else if (a <= 2d-9) then
tmp = x + ((y * (t - z)) / a)
else
tmp = x + (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 (a <= -3e+17) {
tmp = x + (y * ((t - z) / a));
} else if (a <= 2e-9) {
tmp = x + ((y * (t - z)) / a);
} else {
tmp = x + (y / (a / (t - z)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -3e+17: tmp = x + (y * ((t - z) / a)) elif a <= 2e-9: tmp = x + ((y * (t - z)) / a) else: tmp = x + (y / (a / (t - z))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -3e+17) tmp = Float64(x + Float64(y * Float64(Float64(t - z) / a))); elseif (a <= 2e-9) tmp = Float64(x + Float64(Float64(y * Float64(t - z)) / a)); else tmp = Float64(x + Float64(y / Float64(a / Float64(t - z)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -3e+17) tmp = x + (y * ((t - z) / a)); elseif (a <= 2e-9) tmp = x + ((y * (t - z)) / a); else tmp = x + (y / (a / (t - z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -3e+17], N[(x + N[(y * N[(N[(t - z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 2e-9], N[(x + N[(N[(y * N[(t - z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / N[(a / N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -3 \cdot 10^{+17}:\\
\;\;\;\;x + y \cdot \frac{t - z}{a}\\
\mathbf{elif}\;a \leq 2 \cdot 10^{-9}:\\
\;\;\;\;x + \frac{y \cdot \left(t - z\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{a}{t - z}}\\
\end{array}
\end{array}
if a < -3e17Initial program 78.9%
associate-/l*99.9%
Simplified99.9%
if -3e17 < a < 2.00000000000000012e-9Initial program 99.9%
if 2.00000000000000012e-9 < a Initial program 85.2%
associate-/l*99.9%
Simplified99.9%
clear-num99.8%
un-div-inv99.9%
Applied egg-rr99.9%
Final simplification99.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.45e+82) (not (<= z 1.65e+87))) (- x (* y (/ z a))) (+ x (/ (* y t) a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.45e+82) || !(z <= 1.65e+87)) {
tmp = x - (y * (z / a));
} 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 <= (-1.45d+82)) .or. (.not. (z <= 1.65d+87))) then
tmp = x - (y * (z / a))
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 <= -1.45e+82) || !(z <= 1.65e+87)) {
tmp = x - (y * (z / a));
} else {
tmp = x + ((y * t) / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.45e+82) or not (z <= 1.65e+87): tmp = x - (y * (z / a)) else: tmp = x + ((y * t) / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.45e+82) || !(z <= 1.65e+87)) tmp = Float64(x - Float64(y * Float64(z / a))); 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 <= -1.45e+82) || ~((z <= 1.65e+87))) tmp = x - (y * (z / a)); else tmp = x + ((y * t) / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.45e+82], N[Not[LessEqual[z, 1.65e+87]], $MachinePrecision]], N[(x - N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.45 \cdot 10^{+82} \lor \neg \left(z \leq 1.65 \cdot 10^{+87}\right):\\
\;\;\;\;x - y \cdot \frac{z}{a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot t}{a}\\
\end{array}
\end{array}
if z < -1.4500000000000001e82 or 1.6500000000000001e87 < z Initial program 86.0%
associate-/l*92.6%
Simplified92.6%
Taylor expanded in z around inf 79.9%
associate-/l*84.6%
Simplified84.6%
if -1.4500000000000001e82 < z < 1.6500000000000001e87Initial program 95.6%
sub-neg95.6%
distribute-frac-neg295.6%
+-commutative95.6%
associate-/l*91.9%
fma-define92.0%
distribute-frac-neg292.0%
distribute-neg-frac92.0%
sub-neg92.0%
distribute-neg-in92.0%
remove-double-neg92.0%
+-commutative92.0%
sub-neg92.0%
Simplified92.0%
Taylor expanded in z around 0 88.0%
Final simplification86.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.35e+169) (not (<= z 9.5e+106))) (* (/ y a) (- t z)) (+ x (/ (* y t) a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.35e+169) || !(z <= 9.5e+106)) {
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 <= (-1.35d+169)) .or. (.not. (z <= 9.5d+106))) 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 <= -1.35e+169) || !(z <= 9.5e+106)) {
tmp = (y / a) * (t - z);
} else {
tmp = x + ((y * t) / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.35e+169) or not (z <= 9.5e+106): 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 <= -1.35e+169) || !(z <= 9.5e+106)) 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 <= -1.35e+169) || ~((z <= 9.5e+106))) 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, -1.35e+169], N[Not[LessEqual[z, 9.5e+106]], $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 -1.35 \cdot 10^{+169} \lor \neg \left(z \leq 9.5 \cdot 10^{+106}\right):\\
\;\;\;\;\frac{y}{a} \cdot \left(t - z\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot t}{a}\\
\end{array}
\end{array}
if z < -1.34999999999999995e169 or 9.4999999999999995e106 < z Initial program 84.6%
associate-/l*90.6%
Simplified90.6%
Taylor expanded in x around 0 72.6%
mul-1-neg72.6%
associate-*l/82.7%
distribute-rgt-neg-in82.7%
sub-neg82.7%
distribute-neg-in82.7%
remove-double-neg82.7%
+-commutative82.7%
sub-neg82.7%
Simplified82.7%
if -1.34999999999999995e169 < z < 9.4999999999999995e106Initial program 95.0%
sub-neg95.0%
distribute-frac-neg295.0%
+-commutative95.0%
associate-/l*92.9%
fma-define93.0%
distribute-frac-neg293.0%
distribute-neg-frac93.0%
sub-neg93.0%
distribute-neg-in93.0%
remove-double-neg93.0%
+-commutative93.0%
sub-neg93.0%
Simplified93.0%
Taylor expanded in z around 0 86.2%
Final simplification85.1%
(FPCore (x y z t a) :precision binary64 (if (<= z -3.3e+81) (- x (/ y (/ a z))) (if (<= z 1.3e+87) (+ x (/ (* y t) a)) (- x (* y (/ z a))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.3e+81) {
tmp = x - (y / (a / z));
} else if (z <= 1.3e+87) {
tmp = x + ((y * t) / a);
} 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 (z <= (-3.3d+81)) then
tmp = x - (y / (a / z))
else if (z <= 1.3d+87) then
tmp = x + ((y * t) / a)
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 (z <= -3.3e+81) {
tmp = x - (y / (a / z));
} else if (z <= 1.3e+87) {
tmp = x + ((y * t) / a);
} else {
tmp = x - (y * (z / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -3.3e+81: tmp = x - (y / (a / z)) elif z <= 1.3e+87: tmp = x + ((y * t) / a) else: tmp = x - (y * (z / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -3.3e+81) tmp = Float64(x - Float64(y / Float64(a / z))); elseif (z <= 1.3e+87) tmp = Float64(x + Float64(Float64(y * t) / a)); 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 (z <= -3.3e+81) tmp = x - (y / (a / z)); elseif (z <= 1.3e+87) tmp = x + ((y * t) / a); else tmp = x - (y * (z / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -3.3e+81], N[(x - N[(y / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.3e+87], N[(x + N[(N[(y * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(x - N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.3 \cdot 10^{+81}:\\
\;\;\;\;x - \frac{y}{\frac{a}{z}}\\
\mathbf{elif}\;z \leq 1.3 \cdot 10^{+87}:\\
\;\;\;\;x + \frac{y \cdot t}{a}\\
\mathbf{else}:\\
\;\;\;\;x - y \cdot \frac{z}{a}\\
\end{array}
\end{array}
if z < -3.3e81Initial program 86.3%
associate-/l*90.3%
Simplified90.3%
clear-num90.4%
un-div-inv92.9%
Applied egg-rr92.9%
Taylor expanded in z around inf 85.1%
if -3.3e81 < z < 1.29999999999999999e87Initial program 95.6%
sub-neg95.6%
distribute-frac-neg295.6%
+-commutative95.6%
associate-/l*91.9%
fma-define92.0%
distribute-frac-neg292.0%
distribute-neg-frac92.0%
sub-neg92.0%
distribute-neg-in92.0%
remove-double-neg92.0%
+-commutative92.0%
sub-neg92.0%
Simplified92.0%
Taylor expanded in z around 0 88.0%
if 1.29999999999999999e87 < z Initial program 85.7%
associate-/l*94.7%
Simplified94.7%
Taylor expanded in z around inf 78.3%
associate-/l*85.4%
Simplified85.4%
Final simplification86.9%
(FPCore (x y z t a) :precision binary64 (if (<= a -5e+194) x (if (<= a 2e-24) (* (- t z) (/ y a)) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -5e+194) {
tmp = x;
} else if (a <= 2e-24) {
tmp = (t - z) * (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 (a <= (-5d+194)) then
tmp = x
else if (a <= 2d-24) then
tmp = (t - z) * (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 (a <= -5e+194) {
tmp = x;
} else if (a <= 2e-24) {
tmp = (t - z) * (y / a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -5e+194: tmp = x elif a <= 2e-24: tmp = (t - z) * (y / a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -5e+194) tmp = x; elseif (a <= 2e-24) tmp = Float64(Float64(t - z) * Float64(y / a)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -5e+194) tmp = x; elseif (a <= 2e-24) tmp = (t - z) * (y / a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -5e+194], x, If[LessEqual[a, 2e-24], N[(N[(t - z), $MachinePrecision] * N[(y / a), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -5 \cdot 10^{+194}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 2 \cdot 10^{-24}:\\
\;\;\;\;\left(t - z\right) \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -4.99999999999999989e194 or 1.99999999999999985e-24 < a Initial program 82.9%
associate-/l*98.8%
Simplified98.8%
Taylor expanded in x around inf 63.2%
if -4.99999999999999989e194 < a < 1.99999999999999985e-24Initial program 96.5%
associate-/l*88.7%
Simplified88.7%
Taylor expanded in x around 0 77.3%
mul-1-neg77.3%
associate-*l/76.7%
distribute-rgt-neg-in76.7%
sub-neg76.7%
distribute-neg-in76.7%
remove-double-neg76.7%
+-commutative76.7%
sub-neg76.7%
Simplified76.7%
Final simplification72.0%
(FPCore (x y z t a) :precision binary64 (if (<= a -17000000000.0) x (if (<= a 3.2e-86) (* t (/ y a)) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -17000000000.0) {
tmp = x;
} else if (a <= 3.2e-86) {
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 (a <= (-17000000000.0d0)) then
tmp = x
else if (a <= 3.2d-86) 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 (a <= -17000000000.0) {
tmp = x;
} else if (a <= 3.2e-86) {
tmp = t * (y / a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -17000000000.0: tmp = x elif a <= 3.2e-86: tmp = t * (y / a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -17000000000.0) tmp = x; elseif (a <= 3.2e-86) 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 (a <= -17000000000.0) tmp = x; elseif (a <= 3.2e-86) tmp = t * (y / a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -17000000000.0], x, If[LessEqual[a, 3.2e-86], N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -17000000000:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 3.2 \cdot 10^{-86}:\\
\;\;\;\;t \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -1.7e10 or 3.20000000000000006e-86 < a Initial program 84.8%
associate-/l*98.5%
Simplified98.5%
Taylor expanded in x around inf 54.7%
if -1.7e10 < a < 3.20000000000000006e-86Initial program 99.9%
associate-/l*84.8%
Simplified84.8%
Taylor expanded in t around inf 57.4%
associate-/l*60.6%
Simplified60.6%
(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.8%
associate-/l*92.2%
Simplified92.2%
Taylor expanded in x around inf 36.2%
(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 2024116
(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)))