
(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 (- x (/ 1.0 (/ (/ a y) (- z t)))))
double code(double x, double y, double z, double t, double a) {
return x - (1.0 / ((a / y) / (z - t)));
}
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 - (1.0d0 / ((a / y) / (z - t)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x - (1.0 / ((a / y) / (z - t)));
}
def code(x, y, z, t, a): return x - (1.0 / ((a / y) / (z - t)))
function code(x, y, z, t, a) return Float64(x - Float64(1.0 / Float64(Float64(a / y) / Float64(z - t)))) end
function tmp = code(x, y, z, t, a) tmp = x - (1.0 / ((a / y) / (z - t))); end
code[x_, y_, z_, t_, a_] := N[(x - N[(1.0 / N[(N[(a / y), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{1}{\frac{\frac{a}{y}}{z - t}}
\end{array}
Initial program 92.8%
associate-*r/94.0%
*-commutative94.0%
div-inv93.9%
associate-*l*96.9%
Applied egg-rr96.9%
*-commutative96.9%
associate-*l*92.7%
add-sqr-sqrt49.7%
unpow249.7%
associate-/r/49.7%
unpow249.7%
add-sqr-sqrt92.7%
associate-/r*97.2%
Applied egg-rr97.2%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (* y (* (/ 1.0 a) (- t z))))) (if (<= y -8e-45) t_1 (if (<= y 1.5e+29) (- x (* (/ y a) z)) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = y * ((1.0 / a) * (t - z));
double tmp;
if (y <= -8e-45) {
tmp = t_1;
} else if (y <= 1.5e+29) {
tmp = x - ((y / a) * z);
} 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 = y * ((1.0d0 / a) * (t - z))
if (y <= (-8d-45)) then
tmp = t_1
else if (y <= 1.5d+29) then
tmp = x - ((y / a) * z)
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 = y * ((1.0 / a) * (t - z));
double tmp;
if (y <= -8e-45) {
tmp = t_1;
} else if (y <= 1.5e+29) {
tmp = x - ((y / a) * z);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = y * ((1.0 / a) * (t - z)) tmp = 0 if y <= -8e-45: tmp = t_1 elif y <= 1.5e+29: tmp = x - ((y / a) * z) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(y * Float64(Float64(1.0 / a) * Float64(t - z))) tmp = 0.0 if (y <= -8e-45) tmp = t_1; elseif (y <= 1.5e+29) tmp = Float64(x - Float64(Float64(y / a) * z)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = y * ((1.0 / a) * (t - z)); tmp = 0.0; if (y <= -8e-45) tmp = t_1; elseif (y <= 1.5e+29) tmp = x - ((y / a) * z); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[(N[(1.0 / a), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -8e-45], t$95$1, If[LessEqual[y, 1.5e+29], N[(x - N[(N[(y / a), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(\frac{1}{a} \cdot \left(t - z\right)\right)\\
\mathbf{if}\;y \leq -8 \cdot 10^{-45}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.5 \cdot 10^{+29}:\\
\;\;\;\;x - \frac{y}{a} \cdot z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -7.99999999999999987e-45 or 1.5e29 < y Initial program 88.1%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in y around inf 80.8%
div-inv80.7%
div-inv80.7%
distribute-rgt-out--84.4%
Applied egg-rr84.4%
if -7.99999999999999987e-45 < y < 1.5e29Initial program 98.1%
associate-/l*87.4%
Simplified87.4%
Taylor expanded in z around inf 75.2%
clear-num75.2%
un-div-inv75.7%
Applied egg-rr75.7%
associate-/r/80.3%
Applied egg-rr80.3%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (* (/ y a) (- t z)))) (if (<= y -2.25e-105) t_1 (if (<= y 8e-78) x t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y / a) * (t - z);
double tmp;
if (y <= -2.25e-105) {
tmp = t_1;
} else if (y <= 8e-78) {
tmp = x;
} 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 = (y / a) * (t - z)
if (y <= (-2.25d-105)) then
tmp = t_1
else if (y <= 8d-78) then
tmp = x
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 = (y / a) * (t - z);
double tmp;
if (y <= -2.25e-105) {
tmp = t_1;
} else if (y <= 8e-78) {
tmp = x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y / a) * (t - z) tmp = 0 if y <= -2.25e-105: tmp = t_1 elif y <= 8e-78: tmp = x else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y / a) * Float64(t - z)) tmp = 0.0 if (y <= -2.25e-105) tmp = t_1; elseif (y <= 8e-78) tmp = x; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y / a) * (t - z); tmp = 0.0; if (y <= -2.25e-105) tmp = t_1; elseif (y <= 8e-78) tmp = x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y / a), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2.25e-105], t$95$1, If[LessEqual[y, 8e-78], x, t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{a} \cdot \left(t - z\right)\\
\mathbf{if}\;y \leq -2.25 \cdot 10^{-105}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 8 \cdot 10^{-78}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -2.2499999999999999e-105 or 7.99999999999999999e-78 < y Initial program 89.5%
associate-/l*98.7%
Simplified98.7%
Taylor expanded in y around inf 74.5%
*-commutative74.5%
sub-div78.1%
associate-*l/70.7%
Applied egg-rr70.7%
associate-/l*77.0%
*-commutative77.0%
Applied egg-rr77.0%
if -2.2499999999999999e-105 < y < 7.99999999999999999e-78Initial program 98.7%
associate-/l*85.4%
Simplified85.4%
Taylor expanded in x around inf 68.5%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (- x (* y (/ z a))))) (if (<= x -1.42e-157) t_1 (if (<= x 2300.0) (* (/ y a) (- t z)) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x - (y * (z / a));
double tmp;
if (x <= -1.42e-157) {
tmp = t_1;
} else if (x <= 2300.0) {
tmp = (y / a) * (t - z);
} 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 * (z / a))
if (x <= (-1.42d-157)) then
tmp = t_1
else if (x <= 2300.0d0) then
tmp = (y / a) * (t - z)
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 * (z / a));
double tmp;
if (x <= -1.42e-157) {
tmp = t_1;
} else if (x <= 2300.0) {
tmp = (y / a) * (t - z);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x - (y * (z / a)) tmp = 0 if x <= -1.42e-157: tmp = t_1 elif x <= 2300.0: tmp = (y / a) * (t - z) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(x - Float64(y * Float64(z / a))) tmp = 0.0 if (x <= -1.42e-157) tmp = t_1; elseif (x <= 2300.0) tmp = Float64(Float64(y / a) * Float64(t - z)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x - (y * (z / a)); tmp = 0.0; if (x <= -1.42e-157) tmp = t_1; elseif (x <= 2300.0) tmp = (y / a) * (t - z); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x - N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.42e-157], t$95$1, If[LessEqual[x, 2300.0], N[(N[(y / a), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x - y \cdot \frac{z}{a}\\
\mathbf{if}\;x \leq -1.42 \cdot 10^{-157}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 2300:\\
\;\;\;\;\frac{y}{a} \cdot \left(t - z\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -1.42000000000000001e-157 or 2300 < x Initial program 94.9%
associate-/l*94.5%
Simplified94.5%
Taylor expanded in z around inf 77.0%
if -1.42000000000000001e-157 < x < 2300Initial program 89.3%
associate-/l*93.1%
Simplified93.1%
Taylor expanded in y around inf 79.3%
*-commutative79.3%
sub-div81.3%
associate-*l/78.3%
Applied egg-rr78.3%
associate-/l*84.1%
*-commutative84.1%
Applied egg-rr84.1%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (- x (* (/ y a) z)))) (if (<= x -1.42e-157) t_1 (if (<= x 1850.0) (* (/ y a) (- t z)) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x - ((y / a) * z);
double tmp;
if (x <= -1.42e-157) {
tmp = t_1;
} else if (x <= 1850.0) {
tmp = (y / a) * (t - z);
} 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) * z)
if (x <= (-1.42d-157)) then
tmp = t_1
else if (x <= 1850.0d0) then
tmp = (y / a) * (t - z)
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) * z);
double tmp;
if (x <= -1.42e-157) {
tmp = t_1;
} else if (x <= 1850.0) {
tmp = (y / a) * (t - z);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x - ((y / a) * z) tmp = 0 if x <= -1.42e-157: tmp = t_1 elif x <= 1850.0: tmp = (y / a) * (t - z) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(x - Float64(Float64(y / a) * z)) tmp = 0.0 if (x <= -1.42e-157) tmp = t_1; elseif (x <= 1850.0) tmp = Float64(Float64(y / a) * Float64(t - z)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x - ((y / a) * z); tmp = 0.0; if (x <= -1.42e-157) tmp = t_1; elseif (x <= 1850.0) tmp = (y / a) * (t - z); 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] * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.42e-157], t$95$1, If[LessEqual[x, 1850.0], N[(N[(y / a), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x - \frac{y}{a} \cdot z\\
\mathbf{if}\;x \leq -1.42 \cdot 10^{-157}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 1850:\\
\;\;\;\;\frac{y}{a} \cdot \left(t - z\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -1.42000000000000001e-157 or 1850 < x Initial program 94.9%
associate-/l*94.5%
Simplified94.5%
Taylor expanded in z around inf 77.0%
clear-num77.0%
un-div-inv77.4%
Applied egg-rr77.4%
associate-/r/80.4%
Applied egg-rr80.4%
if -1.42000000000000001e-157 < x < 1850Initial program 89.3%
associate-/l*93.1%
Simplified93.1%
Taylor expanded in y around inf 79.3%
*-commutative79.3%
sub-div81.3%
associate-*l/78.3%
Applied egg-rr78.3%
associate-/l*84.1%
*-commutative84.1%
Applied egg-rr84.1%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (* y (/ t a)))) (if (<= t -5.6e-58) t_1 (if (<= t 4.5e+47) x t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = y * (t / a);
double tmp;
if (t <= -5.6e-58) {
tmp = t_1;
} else if (t <= 4.5e+47) {
tmp = x;
} 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 = y * (t / a)
if (t <= (-5.6d-58)) then
tmp = t_1
else if (t <= 4.5d+47) then
tmp = x
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 = y * (t / a);
double tmp;
if (t <= -5.6e-58) {
tmp = t_1;
} else if (t <= 4.5e+47) {
tmp = x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = y * (t / a) tmp = 0 if t <= -5.6e-58: tmp = t_1 elif t <= 4.5e+47: tmp = x else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(y * Float64(t / a)) tmp = 0.0 if (t <= -5.6e-58) tmp = t_1; elseif (t <= 4.5e+47) tmp = x; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = y * (t / a); tmp = 0.0; if (t <= -5.6e-58) tmp = t_1; elseif (t <= 4.5e+47) tmp = x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -5.6e-58], t$95$1, If[LessEqual[t, 4.5e+47], x, t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \frac{t}{a}\\
\mathbf{if}\;t \leq -5.6 \cdot 10^{-58}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 4.5 \cdot 10^{+47}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -5.6000000000000001e-58 or 4.49999999999999979e47 < t Initial program 91.9%
associate-/l*91.8%
Simplified91.8%
Taylor expanded in y around inf 65.0%
Taylor expanded in t around inf 57.8%
if -5.6000000000000001e-58 < t < 4.49999999999999979e47Initial program 93.7%
associate-/l*96.2%
Simplified96.2%
Taylor expanded in x around inf 51.7%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (* (/ y a) t))) (if (<= y -7.4e-45) t_1 (if (<= y 1e-77) x t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y / a) * t;
double tmp;
if (y <= -7.4e-45) {
tmp = t_1;
} else if (y <= 1e-77) {
tmp = x;
} 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 = (y / a) * t
if (y <= (-7.4d-45)) then
tmp = t_1
else if (y <= 1d-77) then
tmp = x
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 = (y / a) * t;
double tmp;
if (y <= -7.4e-45) {
tmp = t_1;
} else if (y <= 1e-77) {
tmp = x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y / a) * t tmp = 0 if y <= -7.4e-45: tmp = t_1 elif y <= 1e-77: tmp = x else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y / a) * t) tmp = 0.0 if (y <= -7.4e-45) tmp = t_1; elseif (y <= 1e-77) tmp = x; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y / a) * t; tmp = 0.0; if (y <= -7.4e-45) tmp = t_1; elseif (y <= 1e-77) tmp = x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y / a), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[y, -7.4e-45], t$95$1, If[LessEqual[y, 1e-77], x, t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{a} \cdot t\\
\mathbf{if}\;y \leq -7.4 \cdot 10^{-45}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 10^{-77}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -7.4e-45 or 9.9999999999999993e-78 < y Initial program 88.8%
associate-/l*99.2%
Simplified99.2%
Taylor expanded in y around inf 76.9%
Taylor expanded in t around inf 47.2%
clear-num47.2%
un-div-inv47.3%
Applied egg-rr47.3%
associate-/r/49.7%
Applied egg-rr49.7%
if -7.4e-45 < y < 9.9999999999999993e-78Initial program 98.8%
associate-/l*86.0%
Simplified86.0%
Taylor expanded in x around inf 66.2%
(FPCore (x y z t a) :precision binary64 (if (<= z -2.7e+190) (- x (* (/ y a) z)) (- x (* y (/ (- z t) a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.7e+190) {
tmp = x - ((y / a) * z);
} 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 (z <= (-2.7d+190)) then
tmp = x - ((y / a) * z)
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 (z <= -2.7e+190) {
tmp = x - ((y / a) * z);
} else {
tmp = x - (y * ((z - t) / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -2.7e+190: tmp = x - ((y / a) * z) else: tmp = x - (y * ((z - t) / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.7e+190) tmp = Float64(x - Float64(Float64(y / a) * z)); else tmp = Float64(x - Float64(y * Float64(Float64(z - t) / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -2.7e+190) tmp = x - ((y / a) * z); else tmp = x - (y * ((z - t) / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.7e+190], N[(x - N[(N[(y / a), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(x - N[(y * N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.7 \cdot 10^{+190}:\\
\;\;\;\;x - \frac{y}{a} \cdot z\\
\mathbf{else}:\\
\;\;\;\;x - y \cdot \frac{z - t}{a}\\
\end{array}
\end{array}
if z < -2.70000000000000004e190Initial program 80.5%
associate-/l*83.5%
Simplified83.5%
Taylor expanded in z around inf 83.5%
clear-num83.3%
un-div-inv83.1%
Applied egg-rr83.1%
associate-/r/96.1%
Applied egg-rr96.1%
if -2.70000000000000004e190 < z Initial program 94.7%
associate-/l*95.6%
Simplified95.6%
(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 92.8%
*-commutative92.8%
associate-/l*96.9%
Applied egg-rr96.9%
(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.8%
associate-/l*94.0%
Simplified94.0%
Taylor expanded in x around inf 38.5%
(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 2024076 -o generate:simplify
(FPCore (x y z t a)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, F"
:precision binary64
:alt
(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)))