
(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 (or (<= a -1.55e+56) (not (<= a 1.18e-7))) (+ x (* y (/ (- t z) a))) (+ x (/ (* y (- t z)) a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -1.55e+56) || !(a <= 1.18e-7)) {
tmp = x + (y * ((t - z) / 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) :: tmp
if ((a <= (-1.55d+56)) .or. (.not. (a <= 1.18d-7))) then
tmp = x + (y * ((t - z) / 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 tmp;
if ((a <= -1.55e+56) || !(a <= 1.18e-7)) {
tmp = x + (y * ((t - z) / a));
} else {
tmp = x + ((y * (t - z)) / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -1.55e+56) or not (a <= 1.18e-7): tmp = x + (y * ((t - z) / a)) else: tmp = x + ((y * (t - z)) / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -1.55e+56) || !(a <= 1.18e-7)) tmp = Float64(x + Float64(y * Float64(Float64(t - z) / 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) tmp = 0.0; if ((a <= -1.55e+56) || ~((a <= 1.18e-7))) tmp = x + (y * ((t - z) / a)); else tmp = x + ((y * (t - z)) / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -1.55e+56], N[Not[LessEqual[a, 1.18e-7]], $MachinePrecision]], N[(x + N[(y * N[(N[(t - z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y * N[(t - z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.55 \cdot 10^{+56} \lor \neg \left(a \leq 1.18 \cdot 10^{-7}\right):\\
\;\;\;\;x + y \cdot \frac{t - z}{a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot \left(t - z\right)}{a}\\
\end{array}
\end{array}
if a < -1.55000000000000002e56 or 1.18e-7 < a Initial program 88.3%
associate-/l*99.9%
Simplified99.9%
if -1.55000000000000002e56 < a < 1.18e-7Initial program 99.1%
Final simplification99.5%
(FPCore (x y z t a) :precision binary64 (if (<= x -2.85e-41) x (if (<= x -6e-135) (/ z (/ (- a) y)) (if (<= x 0.000175) (* t (/ y a)) x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -2.85e-41) {
tmp = x;
} else if (x <= -6e-135) {
tmp = z / (-a / y);
} else if (x <= 0.000175) {
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 <= (-2.85d-41)) then
tmp = x
else if (x <= (-6d-135)) then
tmp = z / (-a / y)
else if (x <= 0.000175d0) 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 <= -2.85e-41) {
tmp = x;
} else if (x <= -6e-135) {
tmp = z / (-a / y);
} else if (x <= 0.000175) {
tmp = t * (y / a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if x <= -2.85e-41: tmp = x elif x <= -6e-135: tmp = z / (-a / y) elif x <= 0.000175: tmp = t * (y / a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (x <= -2.85e-41) tmp = x; elseif (x <= -6e-135) tmp = Float64(z / Float64(Float64(-a) / y)); elseif (x <= 0.000175) 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 <= -2.85e-41) tmp = x; elseif (x <= -6e-135) tmp = z / (-a / y); elseif (x <= 0.000175) tmp = t * (y / a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -2.85e-41], x, If[LessEqual[x, -6e-135], N[(z / N[((-a) / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.000175], N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision], x]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.85 \cdot 10^{-41}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq -6 \cdot 10^{-135}:\\
\;\;\;\;\frac{z}{\frac{-a}{y}}\\
\mathbf{elif}\;x \leq 0.000175:\\
\;\;\;\;t \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -2.85000000000000023e-41 or 1.74999999999999998e-4 < x Initial program 93.0%
associate-/l*91.5%
Simplified91.5%
Taylor expanded in x around inf 59.5%
if -2.85000000000000023e-41 < x < -6.00000000000000024e-135Initial program 99.6%
associate-/l*85.7%
Simplified85.7%
Taylor expanded in z around inf 71.2%
mul-1-neg71.2%
associate-/l*61.6%
distribute-rgt-neg-in61.6%
distribute-frac-neg261.6%
Simplified61.6%
associate-*r/71.2%
distribute-frac-neg271.2%
div-inv71.2%
*-commutative71.2%
associate-*l*71.2%
div-inv71.2%
Applied egg-rr71.2%
distribute-lft-neg-in71.2%
clear-num71.3%
un-div-inv71.4%
Applied egg-rr71.4%
if -6.00000000000000024e-135 < x < 1.74999999999999998e-4Initial program 93.4%
associate-/l*94.4%
Simplified94.4%
add-cube-cbrt93.2%
pow393.2%
associate-*r/92.2%
*-commutative92.2%
associate-/l*93.1%
Applied egg-rr93.1%
Taylor expanded in t around inf 49.0%
associate-/l*53.4%
Simplified53.4%
Final simplification58.0%
(FPCore (x y z t a) :precision binary64 (if (<= x -1.75e-38) x (if (<= x -2.8e-134) (* z (/ y (- a))) (if (<= x 1.9e-6) (* t (/ y a)) x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -1.75e-38) {
tmp = x;
} else if (x <= -2.8e-134) {
tmp = z * (y / -a);
} else if (x <= 1.9e-6) {
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 <= (-1.75d-38)) then
tmp = x
else if (x <= (-2.8d-134)) then
tmp = z * (y / -a)
else if (x <= 1.9d-6) 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 <= -1.75e-38) {
tmp = x;
} else if (x <= -2.8e-134) {
tmp = z * (y / -a);
} else if (x <= 1.9e-6) {
tmp = t * (y / a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if x <= -1.75e-38: tmp = x elif x <= -2.8e-134: tmp = z * (y / -a) elif x <= 1.9e-6: tmp = t * (y / a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (x <= -1.75e-38) tmp = x; elseif (x <= -2.8e-134) tmp = Float64(z * Float64(y / Float64(-a))); elseif (x <= 1.9e-6) 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 <= -1.75e-38) tmp = x; elseif (x <= -2.8e-134) tmp = z * (y / -a); elseif (x <= 1.9e-6) tmp = t * (y / a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -1.75e-38], x, If[LessEqual[x, -2.8e-134], N[(z * N[(y / (-a)), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.9e-6], N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision], x]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.75 \cdot 10^{-38}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq -2.8 \cdot 10^{-134}:\\
\;\;\;\;z \cdot \frac{y}{-a}\\
\mathbf{elif}\;x \leq 1.9 \cdot 10^{-6}:\\
\;\;\;\;t \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -1.7500000000000001e-38 or 1.9e-6 < x Initial program 93.0%
associate-/l*91.5%
Simplified91.5%
Taylor expanded in x around inf 59.5%
if -1.7500000000000001e-38 < x < -2.7999999999999999e-134Initial program 99.6%
associate-/l*85.7%
Simplified85.7%
Taylor expanded in z around inf 71.2%
mul-1-neg71.2%
associate-/l*61.6%
distribute-rgt-neg-in61.6%
distribute-frac-neg261.6%
Simplified61.6%
associate-*r/71.2%
distribute-frac-neg271.2%
div-inv71.2%
*-commutative71.2%
associate-*l*71.2%
div-inv71.2%
Applied egg-rr71.2%
if -2.7999999999999999e-134 < x < 1.9e-6Initial program 93.4%
associate-/l*94.4%
Simplified94.4%
add-cube-cbrt93.2%
pow393.2%
associate-*r/92.2%
*-commutative92.2%
associate-/l*93.1%
Applied egg-rr93.1%
Taylor expanded in t around inf 49.0%
associate-/l*53.4%
Simplified53.4%
Final simplification57.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -2e+60) (not (<= z 4.5e+107))) (- x (/ (* y z) a)) (+ x (* t (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -2e+60) || !(z <= 4.5e+107)) {
tmp = x - ((y * z) / a);
} else {
tmp = x + (t * (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 ((z <= (-2d+60)) .or. (.not. (z <= 4.5d+107))) then
tmp = x - ((y * z) / a)
else
tmp = x + (t * (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 ((z <= -2e+60) || !(z <= 4.5e+107)) {
tmp = x - ((y * z) / a);
} else {
tmp = x + (t * (y / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -2e+60) or not (z <= 4.5e+107): tmp = x - ((y * z) / a) else: tmp = x + (t * (y / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -2e+60) || !(z <= 4.5e+107)) tmp = Float64(x - Float64(Float64(y * z) / a)); else tmp = Float64(x + Float64(t * Float64(y / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -2e+60) || ~((z <= 4.5e+107))) tmp = x - ((y * z) / a); else tmp = x + (t * (y / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -2e+60], N[Not[LessEqual[z, 4.5e+107]], $MachinePrecision]], N[(x - N[(N[(y * z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(x + N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2 \cdot 10^{+60} \lor \neg \left(z \leq 4.5 \cdot 10^{+107}\right):\\
\;\;\;\;x - \frac{y \cdot z}{a}\\
\mathbf{else}:\\
\;\;\;\;x + t \cdot \frac{y}{a}\\
\end{array}
\end{array}
if z < -1.9999999999999999e60 or 4.5e107 < z Initial program 94.2%
associate-/l*89.5%
Simplified89.5%
Taylor expanded in z around inf 89.0%
if -1.9999999999999999e60 < z < 4.5e107Initial program 93.3%
associate-/l*93.9%
Simplified93.9%
add-cube-cbrt92.4%
pow392.5%
associate-*r/91.8%
*-commutative91.8%
associate-/l*95.9%
Applied egg-rr95.9%
Taylor expanded in z around 0 84.4%
mul-1-neg84.4%
associate-/l*89.1%
distribute-lft-neg-out89.1%
cancel-sign-sub89.1%
Simplified89.1%
Final simplification89.1%
(FPCore (x y z t a) :precision binary64 (if (or (<= x -1.2e-36) (not (<= x 6.6e-20))) (+ x (* t (/ y a))) (* (/ y a) (- t z))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x <= -1.2e-36) || !(x <= 6.6e-20)) {
tmp = x + (t * (y / 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 ((x <= (-1.2d-36)) .or. (.not. (x <= 6.6d-20))) then
tmp = x + (t * (y / 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 ((x <= -1.2e-36) || !(x <= 6.6e-20)) {
tmp = x + (t * (y / a));
} else {
tmp = (y / a) * (t - z);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (x <= -1.2e-36) or not (x <= 6.6e-20): tmp = x + (t * (y / a)) else: tmp = (y / a) * (t - z) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((x <= -1.2e-36) || !(x <= 6.6e-20)) tmp = Float64(x + Float64(t * Float64(y / 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 ((x <= -1.2e-36) || ~((x <= 6.6e-20))) tmp = x + (t * (y / a)); else tmp = (y / a) * (t - z); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[x, -1.2e-36], N[Not[LessEqual[x, 6.6e-20]], $MachinePrecision]], N[(x + N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y / a), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.2 \cdot 10^{-36} \lor \neg \left(x \leq 6.6 \cdot 10^{-20}\right):\\
\;\;\;\;x + t \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a} \cdot \left(t - z\right)\\
\end{array}
\end{array}
if x < -1.2e-36 or 6.6e-20 < x Initial program 93.2%
associate-/l*91.8%
Simplified91.8%
add-cube-cbrt90.5%
pow390.5%
associate-*r/91.8%
*-commutative91.8%
associate-/l*97.8%
Applied egg-rr97.8%
Taylor expanded in z around 0 77.0%
mul-1-neg77.0%
associate-/l*84.4%
distribute-lft-neg-out84.4%
cancel-sign-sub84.4%
Simplified84.4%
if -1.2e-36 < x < 6.6e-20Initial program 94.2%
associate-/l*92.7%
Simplified92.7%
Taylor expanded in x around 0 82.1%
associate-*r/82.1%
neg-mul-182.1%
*-commutative82.1%
distribute-lft-neg-in82.1%
associate-*r/82.9%
*-commutative82.9%
neg-sub082.9%
sub-neg82.9%
+-commutative82.9%
associate--r+82.9%
neg-sub082.9%
remove-double-neg82.9%
Simplified82.9%
Final simplification83.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= y -1.9e-86) (not (<= y 1.35e-88))) (* (/ y a) (- t z)) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -1.9e-86) || !(y <= 1.35e-88)) {
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 ((y <= (-1.9d-86)) .or. (.not. (y <= 1.35d-88))) 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 ((y <= -1.9e-86) || !(y <= 1.35e-88)) {
tmp = (y / a) * (t - z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (y <= -1.9e-86) or not (y <= 1.35e-88): tmp = (y / a) * (t - z) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((y <= -1.9e-86) || !(y <= 1.35e-88)) 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 ((y <= -1.9e-86) || ~((y <= 1.35e-88))) tmp = (y / a) * (t - z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[y, -1.9e-86], N[Not[LessEqual[y, 1.35e-88]], $MachinePrecision]], N[(N[(y / a), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.9 \cdot 10^{-86} \lor \neg \left(y \leq 1.35 \cdot 10^{-88}\right):\\
\;\;\;\;\frac{y}{a} \cdot \left(t - z\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1.9e-86 or 1.34999999999999997e-88 < y Initial program 90.3%
associate-/l*98.1%
Simplified98.1%
Taylor expanded in x around 0 70.4%
associate-*r/70.4%
neg-mul-170.4%
*-commutative70.4%
distribute-lft-neg-in70.4%
associate-*r/78.3%
*-commutative78.3%
neg-sub078.3%
sub-neg78.3%
+-commutative78.3%
associate--r+78.3%
neg-sub078.3%
remove-double-neg78.3%
Simplified78.3%
if -1.9e-86 < y < 1.34999999999999997e-88Initial program 98.9%
associate-/l*83.0%
Simplified83.0%
Taylor expanded in x around inf 65.5%
Final simplification73.3%
(FPCore (x y z t a) :precision binary64 (if (<= z -2.8e+60) (- x (* y (/ z a))) (if (<= z 5.2e+91) (+ x (* t (/ y a))) (* (/ y a) (- t z)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.8e+60) {
tmp = x - (y * (z / a));
} else if (z <= 5.2e+91) {
tmp = x + (t * (y / 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 (z <= (-2.8d+60)) then
tmp = x - (y * (z / a))
else if (z <= 5.2d+91) then
tmp = x + (t * (y / 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 (z <= -2.8e+60) {
tmp = x - (y * (z / a));
} else if (z <= 5.2e+91) {
tmp = x + (t * (y / a));
} else {
tmp = (y / a) * (t - z);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -2.8e+60: tmp = x - (y * (z / a)) elif z <= 5.2e+91: tmp = x + (t * (y / a)) else: tmp = (y / a) * (t - z) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.8e+60) tmp = Float64(x - Float64(y * Float64(z / a))); elseif (z <= 5.2e+91) tmp = Float64(x + Float64(t * Float64(y / 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 (z <= -2.8e+60) tmp = x - (y * (z / a)); elseif (z <= 5.2e+91) tmp = x + (t * (y / a)); else tmp = (y / a) * (t - z); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.8e+60], N[(x - N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5.2e+91], N[(x + N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y / a), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.8 \cdot 10^{+60}:\\
\;\;\;\;x - y \cdot \frac{z}{a}\\
\mathbf{elif}\;z \leq 5.2 \cdot 10^{+91}:\\
\;\;\;\;x + t \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a} \cdot \left(t - z\right)\\
\end{array}
\end{array}
if z < -2.8e60Initial program 97.1%
associate-/l*94.4%
Simplified94.4%
Taylor expanded in z around inf 91.3%
associate-/l*87.1%
Simplified87.1%
if -2.8e60 < z < 5.2000000000000001e91Initial program 93.2%
associate-/l*93.8%
Simplified93.8%
add-cube-cbrt92.4%
pow392.4%
associate-*r/91.7%
*-commutative91.7%
associate-/l*95.8%
Applied egg-rr95.8%
Taylor expanded in z around 0 84.5%
mul-1-neg84.5%
associate-/l*89.3%
distribute-lft-neg-out89.3%
cancel-sign-sub89.3%
Simplified89.3%
if 5.2000000000000001e91 < z Initial program 88.4%
associate-/l*79.8%
Simplified79.8%
Taylor expanded in x around 0 70.1%
associate-*r/70.1%
neg-mul-170.1%
*-commutative70.1%
distribute-lft-neg-in70.1%
associate-*r/79.5%
*-commutative79.5%
neg-sub079.5%
sub-neg79.5%
+-commutative79.5%
associate--r+79.5%
neg-sub079.5%
remove-double-neg79.5%
Simplified79.5%
(FPCore (x y z t a) :precision binary64 (if (<= a -9.6e-59) x (if (<= a 0.0096) (* t (/ y a)) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -9.6e-59) {
tmp = x;
} else if (a <= 0.0096) {
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 <= (-9.6d-59)) then
tmp = x
else if (a <= 0.0096d0) 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 <= -9.6e-59) {
tmp = x;
} else if (a <= 0.0096) {
tmp = t * (y / a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -9.6e-59: tmp = x elif a <= 0.0096: tmp = t * (y / a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -9.6e-59) tmp = x; elseif (a <= 0.0096) 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 <= -9.6e-59) tmp = x; elseif (a <= 0.0096) tmp = t * (y / a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -9.6e-59], x, If[LessEqual[a, 0.0096], N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -9.6 \cdot 10^{-59}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 0.0096:\\
\;\;\;\;t \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -9.6000000000000006e-59 or 0.00959999999999999916 < a Initial program 89.5%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in x around inf 56.0%
if -9.6000000000000006e-59 < a < 0.00959999999999999916Initial program 99.0%
associate-/l*82.3%
Simplified82.3%
add-cube-cbrt81.8%
pow381.8%
associate-*r/98.0%
*-commutative98.0%
associate-/l*98.1%
Applied egg-rr98.1%
Taylor expanded in t around inf 49.0%
associate-/l*54.9%
Simplified54.9%
(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 93.7%
associate-/l*92.2%
Simplified92.2%
clear-num92.2%
un-div-inv93.1%
Applied egg-rr93.1%
Final simplification93.1%
(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 93.7%
associate-/l*92.2%
Simplified92.2%
Final simplification92.2%
(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 93.7%
associate-/l*92.2%
Simplified92.2%
Taylor expanded in x around inf 38.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 2024139
(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)))