
(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
(let* ((t_1 (* (- z t) y)))
(if (<= t_1 -2e+301)
(+ x (* y (/ (- t z) a)))
(if (<= t_1 1e+304) (+ x (/ (* y (- t z)) a)) (* (/ y a) (- t z))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) * y;
double tmp;
if (t_1 <= -2e+301) {
tmp = x + (y * ((t - z) / a));
} else if (t_1 <= 1e+304) {
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) :: t_1
real(8) :: tmp
t_1 = (z - t) * y
if (t_1 <= (-2d+301)) then
tmp = x + (y * ((t - z) / a))
else if (t_1 <= 1d+304) 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 t_1 = (z - t) * y;
double tmp;
if (t_1 <= -2e+301) {
tmp = x + (y * ((t - z) / a));
} else if (t_1 <= 1e+304) {
tmp = x + ((y * (t - z)) / a);
} else {
tmp = (y / a) * (t - z);
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (z - t) * y tmp = 0 if t_1 <= -2e+301: tmp = x + (y * ((t - z) / a)) elif t_1 <= 1e+304: tmp = x + ((y * (t - z)) / a) else: tmp = (y / a) * (t - z) return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) * y) tmp = 0.0 if (t_1 <= -2e+301) tmp = Float64(x + Float64(y * Float64(Float64(t - z) / a))); elseif (t_1 <= 1e+304) tmp = Float64(x + Float64(Float64(y * 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) t_1 = (z - t) * y; tmp = 0.0; if (t_1 <= -2e+301) tmp = x + (y * ((t - z) / a)); elseif (t_1 <= 1e+304) tmp = x + ((y * (t - z)) / a); else tmp = (y / a) * (t - z); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+301], N[(x + N[(y * N[(N[(t - z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+304], N[(x + N[(N[(y * N[(t - z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(N[(y / a), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(z - t\right) \cdot y\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+301}:\\
\;\;\;\;x + y \cdot \frac{t - z}{a}\\
\mathbf{elif}\;t\_1 \leq 10^{+304}:\\
\;\;\;\;x + \frac{y \cdot \left(t - z\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a} \cdot \left(t - z\right)\\
\end{array}
\end{array}
if (*.f64 y (-.f64 z t)) < -2.00000000000000011e301Initial program 71.4%
associate-/l*100.0%
Simplified100.0%
if -2.00000000000000011e301 < (*.f64 y (-.f64 z t)) < 9.9999999999999994e303Initial program 99.4%
if 9.9999999999999994e303 < (*.f64 y (-.f64 z t)) Initial program 77.3%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in x around 0 77.3%
associate-*r/77.3%
neg-mul-177.3%
*-commutative77.3%
distribute-lft-neg-in77.3%
associate-*r/99.9%
*-commutative99.9%
neg-sub099.9%
sub-neg99.9%
+-commutative99.9%
associate--r+99.9%
neg-sub099.9%
remove-double-neg99.9%
Simplified99.9%
Final simplification99.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* t (/ y a))))
(if (<= t -3.3e+56)
t_1
(if (<= t -6.2e-10) (* z (/ y (- a))) (if (<= t 2.05e+123) x t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = t * (y / a);
double tmp;
if (t <= -3.3e+56) {
tmp = t_1;
} else if (t <= -6.2e-10) {
tmp = z * (y / -a);
} else if (t <= 2.05e+123) {
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 = t * (y / a)
if (t <= (-3.3d+56)) then
tmp = t_1
else if (t <= (-6.2d-10)) then
tmp = z * (y / -a)
else if (t <= 2.05d+123) 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 = t * (y / a);
double tmp;
if (t <= -3.3e+56) {
tmp = t_1;
} else if (t <= -6.2e-10) {
tmp = z * (y / -a);
} else if (t <= 2.05e+123) {
tmp = x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = t * (y / a) tmp = 0 if t <= -3.3e+56: tmp = t_1 elif t <= -6.2e-10: tmp = z * (y / -a) elif t <= 2.05e+123: tmp = x else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(t * Float64(y / a)) tmp = 0.0 if (t <= -3.3e+56) tmp = t_1; elseif (t <= -6.2e-10) tmp = Float64(z * Float64(y / Float64(-a))); elseif (t <= 2.05e+123) tmp = x; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = t * (y / a); tmp = 0.0; if (t <= -3.3e+56) tmp = t_1; elseif (t <= -6.2e-10) tmp = z * (y / -a); elseif (t <= 2.05e+123) tmp = x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -3.3e+56], t$95$1, If[LessEqual[t, -6.2e-10], N[(z * N[(y / (-a)), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.05e+123], x, t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t \cdot \frac{y}{a}\\
\mathbf{if}\;t \leq -3.3 \cdot 10^{+56}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -6.2 \cdot 10^{-10}:\\
\;\;\;\;z \cdot \frac{y}{-a}\\
\mathbf{elif}\;t \leq 2.05 \cdot 10^{+123}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -3.30000000000000002e56 or 2.04999999999999995e123 < t Initial program 92.6%
associate-*r/87.7%
*-commutative87.7%
div-inv87.7%
associate-*l*99.8%
Applied egg-rr99.8%
Taylor expanded in t around inf 66.4%
associate-/l*72.5%
Simplified72.5%
if -3.30000000000000002e56 < t < -6.2000000000000003e-10Initial program 81.0%
associate-/l*93.3%
Simplified93.3%
Taylor expanded in z around inf 49.0%
mul-1-neg49.0%
associate-/l*55.4%
distribute-rgt-neg-in55.4%
distribute-frac-neg255.4%
Simplified55.4%
Taylor expanded in y around 0 49.0%
mul-1-neg49.0%
associate-*l/68.3%
distribute-rgt-neg-in68.3%
Simplified68.3%
if -6.2000000000000003e-10 < t < 2.04999999999999995e123Initial program 95.5%
associate-/l*96.1%
Simplified96.1%
Taylor expanded in x around inf 52.7%
Final simplification60.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -2.4e+56) (not (<= t 2.9e+121))) (+ x (* t (/ y a))) (- x (* z (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -2.4e+56) || !(t <= 2.9e+121)) {
tmp = x + (t * (y / a));
} else {
tmp = x - (z * (y / a));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((t <= (-2.4d+56)) .or. (.not. (t <= 2.9d+121))) then
tmp = x + (t * (y / a))
else
tmp = x - (z * (y / a))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -2.4e+56) || !(t <= 2.9e+121)) {
tmp = x + (t * (y / a));
} else {
tmp = x - (z * (y / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -2.4e+56) or not (t <= 2.9e+121): tmp = x + (t * (y / a)) else: tmp = x - (z * (y / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -2.4e+56) || !(t <= 2.9e+121)) tmp = Float64(x + Float64(t * Float64(y / a))); else tmp = Float64(x - Float64(z * Float64(y / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -2.4e+56) || ~((t <= 2.9e+121))) tmp = x + (t * (y / a)); else tmp = x - (z * (y / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -2.4e+56], N[Not[LessEqual[t, 2.9e+121]], $MachinePrecision]], N[(x + N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.4 \cdot 10^{+56} \lor \neg \left(t \leq 2.9 \cdot 10^{+121}\right):\\
\;\;\;\;x + t \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x - z \cdot \frac{y}{a}\\
\end{array}
\end{array}
if t < -2.40000000000000013e56 or 2.8999999999999999e121 < t Initial program 92.6%
associate-*r/87.7%
*-commutative87.7%
div-inv87.7%
associate-*l*99.8%
Applied egg-rr99.8%
Taylor expanded in z around 0 87.4%
mul-1-neg87.4%
distribute-neg-frac287.4%
associate-*r/94.1%
Simplified94.1%
sub-neg94.1%
distribute-rgt-neg-in94.1%
distribute-frac-neg94.1%
frac-2neg94.1%
Applied egg-rr94.1%
if -2.40000000000000013e56 < t < 2.8999999999999999e121Initial program 94.1%
associate-/l*95.9%
Simplified95.9%
Taylor expanded in z around inf 84.9%
*-commutative84.9%
associate-/l*87.1%
Applied egg-rr87.1%
Final simplification89.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -2.7e+56) (not (<= t 2.9e+121))) (+ x (* t (/ y a))) (- x (* y (/ z a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -2.7e+56) || !(t <= 2.9e+121)) {
tmp = x + (t * (y / 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 ((t <= (-2.7d+56)) .or. (.not. (t <= 2.9d+121))) then
tmp = x + (t * (y / 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 ((t <= -2.7e+56) || !(t <= 2.9e+121)) {
tmp = x + (t * (y / a));
} else {
tmp = x - (y * (z / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -2.7e+56) or not (t <= 2.9e+121): tmp = x + (t * (y / a)) else: tmp = x - (y * (z / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -2.7e+56) || !(t <= 2.9e+121)) tmp = Float64(x + Float64(t * Float64(y / 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 ((t <= -2.7e+56) || ~((t <= 2.9e+121))) tmp = x + (t * (y / a)); else tmp = x - (y * (z / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -2.7e+56], N[Not[LessEqual[t, 2.9e+121]], $MachinePrecision]], N[(x + N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.7 \cdot 10^{+56} \lor \neg \left(t \leq 2.9 \cdot 10^{+121}\right):\\
\;\;\;\;x + t \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x - y \cdot \frac{z}{a}\\
\end{array}
\end{array}
if t < -2.7000000000000001e56 or 2.8999999999999999e121 < t Initial program 92.6%
associate-*r/87.7%
*-commutative87.7%
div-inv87.7%
associate-*l*99.8%
Applied egg-rr99.8%
Taylor expanded in z around 0 87.4%
mul-1-neg87.4%
distribute-neg-frac287.4%
associate-*r/94.1%
Simplified94.1%
sub-neg94.1%
distribute-rgt-neg-in94.1%
distribute-frac-neg94.1%
frac-2neg94.1%
Applied egg-rr94.1%
if -2.7000000000000001e56 < t < 2.8999999999999999e121Initial program 94.1%
associate-/l*95.9%
Simplified95.9%
Taylor expanded in z around inf 84.9%
associate-/l*85.6%
Simplified85.6%
Final simplification88.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -5.8e+91) (not (<= z 8.5e+95))) (* (/ y a) (- t z)) (+ x (* t (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -5.8e+91) || !(z <= 8.5e+95)) {
tmp = (y / a) * (t - z);
} 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 <= (-5.8d+91)) .or. (.not. (z <= 8.5d+95))) then
tmp = (y / a) * (t - z)
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 <= -5.8e+91) || !(z <= 8.5e+95)) {
tmp = (y / a) * (t - z);
} else {
tmp = x + (t * (y / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -5.8e+91) or not (z <= 8.5e+95): tmp = (y / a) * (t - z) else: tmp = x + (t * (y / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -5.8e+91) || !(z <= 8.5e+95)) tmp = Float64(Float64(y / a) * Float64(t - z)); 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 <= -5.8e+91) || ~((z <= 8.5e+95))) tmp = (y / a) * (t - z); else tmp = x + (t * (y / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -5.8e+91], N[Not[LessEqual[z, 8.5e+95]], $MachinePrecision]], N[(N[(y / a), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision], N[(x + N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.8 \cdot 10^{+91} \lor \neg \left(z \leq 8.5 \cdot 10^{+95}\right):\\
\;\;\;\;\frac{y}{a} \cdot \left(t - z\right)\\
\mathbf{else}:\\
\;\;\;\;x + t \cdot \frac{y}{a}\\
\end{array}
\end{array}
if z < -5.80000000000000028e91 or 8.5000000000000002e95 < z Initial program 87.6%
associate-/l*85.3%
Simplified85.3%
Taylor expanded in x around 0 71.4%
associate-*r/71.4%
neg-mul-171.4%
*-commutative71.4%
distribute-lft-neg-in71.4%
associate-*r/81.0%
*-commutative81.0%
neg-sub081.0%
sub-neg81.0%
+-commutative81.0%
associate--r+81.0%
neg-sub081.0%
remove-double-neg81.0%
Simplified81.0%
if -5.80000000000000028e91 < z < 8.5000000000000002e95Initial program 96.2%
associate-*r/96.2%
*-commutative96.2%
div-inv96.2%
associate-*l*96.7%
Applied egg-rr96.7%
Taylor expanded in z around 0 83.4%
mul-1-neg83.4%
distribute-neg-frac283.4%
associate-*r/88.2%
Simplified88.2%
sub-neg88.2%
distribute-rgt-neg-in88.2%
distribute-frac-neg88.2%
frac-2neg88.2%
Applied egg-rr88.2%
Final simplification86.0%
(FPCore (x y z t a) :precision binary64 (if (<= a -3.05e+113) x (if (<= a 9.8e+152) (* (/ y a) (- t z)) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -3.05e+113) {
tmp = x;
} else if (a <= 9.8e+152) {
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 (a <= (-3.05d+113)) then
tmp = x
else if (a <= 9.8d+152) 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 (a <= -3.05e+113) {
tmp = x;
} else if (a <= 9.8e+152) {
tmp = (y / a) * (t - z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -3.05e+113: tmp = x elif a <= 9.8e+152: tmp = (y / a) * (t - z) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -3.05e+113) tmp = x; elseif (a <= 9.8e+152) 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 (a <= -3.05e+113) tmp = x; elseif (a <= 9.8e+152) tmp = (y / a) * (t - z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -3.05e+113], x, If[LessEqual[a, 9.8e+152], N[(N[(y / a), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -3.05 \cdot 10^{+113}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 9.8 \cdot 10^{+152}:\\
\;\;\;\;\frac{y}{a} \cdot \left(t - z\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -3.04999999999999998e113 or 9.8000000000000008e152 < a Initial program 83.3%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in x around inf 80.1%
if -3.04999999999999998e113 < a < 9.8000000000000008e152Initial program 97.0%
associate-/l*90.7%
Simplified90.7%
Taylor expanded in x around 0 71.2%
associate-*r/71.2%
neg-mul-171.2%
*-commutative71.2%
distribute-lft-neg-in71.2%
associate-*r/71.2%
*-commutative71.2%
neg-sub071.2%
sub-neg71.2%
+-commutative71.2%
associate--r+71.2%
neg-sub071.2%
remove-double-neg71.2%
Simplified71.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -1.4e+47) (not (<= t 2.9e+121))) (* t (/ y a)) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -1.4e+47) || !(t <= 2.9e+121)) {
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 ((t <= (-1.4d+47)) .or. (.not. (t <= 2.9d+121))) 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 ((t <= -1.4e+47) || !(t <= 2.9e+121)) {
tmp = t * (y / a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -1.4e+47) or not (t <= 2.9e+121): tmp = t * (y / a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -1.4e+47) || !(t <= 2.9e+121)) 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 ((t <= -1.4e+47) || ~((t <= 2.9e+121))) tmp = t * (y / a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -1.4e+47], N[Not[LessEqual[t, 2.9e+121]], $MachinePrecision]], N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.4 \cdot 10^{+47} \lor \neg \left(t \leq 2.9 \cdot 10^{+121}\right):\\
\;\;\;\;t \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -1.39999999999999994e47 or 2.8999999999999999e121 < t Initial program 93.0%
associate-*r/88.3%
*-commutative88.3%
div-inv88.3%
associate-*l*99.8%
Applied egg-rr99.8%
Taylor expanded in t around inf 65.4%
associate-/l*70.2%
Simplified70.2%
if -1.39999999999999994e47 < t < 2.8999999999999999e121Initial program 94.0%
associate-/l*95.8%
Simplified95.8%
Taylor expanded in x around inf 51.4%
Final simplification58.5%
(FPCore (x y z t a) :precision binary64 (if (<= t 8.2e+124) (+ x (* y (/ (- t z) a))) (+ x (* t (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 8.2e+124) {
tmp = x + (y * ((t - 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 (t <= 8.2d+124) then
tmp = x + (y * ((t - 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 (t <= 8.2e+124) {
tmp = x + (y * ((t - z) / a));
} else {
tmp = x + (t * (y / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 8.2e+124: tmp = x + (y * ((t - z) / a)) else: tmp = x + (t * (y / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 8.2e+124) tmp = Float64(x + Float64(y * Float64(Float64(t - 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 (t <= 8.2e+124) tmp = x + (y * ((t - z) / a)); else tmp = x + (t * (y / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 8.2e+124], N[(x + N[(y * N[(N[(t - z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 8.2 \cdot 10^{+124}:\\
\;\;\;\;x + y \cdot \frac{t - z}{a}\\
\mathbf{else}:\\
\;\;\;\;x + t \cdot \frac{y}{a}\\
\end{array}
\end{array}
if t < 8.20000000000000002e124Initial program 93.5%
associate-/l*95.7%
Simplified95.7%
if 8.20000000000000002e124 < t Initial program 94.3%
associate-*r/75.1%
*-commutative75.1%
div-inv75.2%
associate-*l*99.9%
Applied egg-rr99.9%
Taylor expanded in z around 0 94.3%
mul-1-neg94.3%
distribute-neg-frac294.3%
associate-*r/100.0%
Simplified100.0%
sub-neg100.0%
distribute-rgt-neg-in100.0%
distribute-frac-neg100.0%
frac-2neg100.0%
Applied egg-rr100.0%
Final simplification96.2%
(FPCore (x y z t a) :precision binary64 (+ x (* (- z t) (* y (/ -1.0 a)))))
double code(double x, double y, double z, double t, double a) {
return x + ((z - t) * (y * (-1.0 / 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 * ((-1.0d0) / a)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((z - t) * (y * (-1.0 / a)));
}
def code(x, y, z, t, a): return x + ((z - t) * (y * (-1.0 / a)))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(z - t) * Float64(y * Float64(-1.0 / a)))) end
function tmp = code(x, y, z, t, a) tmp = x + ((z - t) * (y * (-1.0 / a))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(z - t), $MachinePrecision] * N[(y * N[(-1.0 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(z - t\right) \cdot \left(y \cdot \frac{-1}{a}\right)
\end{array}
Initial program 93.6%
associate-*r/92.9%
*-commutative92.9%
div-inv92.9%
associate-*l*97.5%
Applied egg-rr97.5%
Final simplification97.5%
(FPCore (x y z t a) :precision binary64 (if (<= y 1.75e-68) x (* a (/ x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= 1.75e-68) {
tmp = x;
} else {
tmp = a * (x / a);
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (y <= 1.75d-68) then
tmp = x
else
tmp = a * (x / a)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= 1.75e-68) {
tmp = x;
} else {
tmp = a * (x / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if y <= 1.75e-68: tmp = x else: tmp = a * (x / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (y <= 1.75e-68) tmp = x; else tmp = Float64(a * Float64(x / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (y <= 1.75e-68) tmp = x; else tmp = a * (x / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, 1.75e-68], x, N[(a * N[(x / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.75 \cdot 10^{-68}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;a \cdot \frac{x}{a}\\
\end{array}
\end{array}
if y < 1.75000000000000006e-68Initial program 95.6%
associate-/l*89.9%
Simplified89.9%
Taylor expanded in x around inf 45.5%
if 1.75000000000000006e-68 < y Initial program 89.0%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in a around 0 78.1%
Taylor expanded in a around inf 16.0%
associate-/l*35.0%
Applied egg-rr35.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 93.6%
associate-/l*92.9%
Simplified92.9%
Taylor expanded in x around inf 40.6%
(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 2024137
(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)))