
(FPCore (x y z t a) :precision binary64 (- x (/ (* y (- z t)) a)))
double code(double x, double y, double z, double t, double a) {
return x - ((y * (z - t)) / a);
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x - ((y * (z - t)) / a)
end function
public static double code(double x, double y, double z, double t, double a) {
return x - ((y * (z - t)) / a);
}
def code(x, y, z, t, a): return x - ((y * (z - t)) / a)
function code(x, y, z, t, a) return Float64(x - Float64(Float64(y * Float64(z - t)) / a)) end
function tmp = code(x, y, z, t, a) tmp = x - ((y * (z - t)) / a); end
code[x_, y_, z_, t_, a_] := N[(x - N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{y \cdot \left(z - t\right)}{a}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (- x (/ (* y (- z t)) a)))
double code(double x, double y, double z, double t, double a) {
return x - ((y * (z - t)) / a);
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x - ((y * (z - t)) / a)
end function
public static double code(double x, double y, double z, double t, double a) {
return x - ((y * (z - t)) / a);
}
def code(x, y, z, t, a): return x - ((y * (z - t)) / a)
function code(x, y, z, t, a) return Float64(x - Float64(Float64(y * Float64(z - t)) / a)) end
function tmp = code(x, y, z, t, a) tmp = x - ((y * (z - t)) / a); end
code[x_, y_, z_, t_, a_] := N[(x - N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{y \cdot \left(z - t\right)}{a}
\end{array}
(FPCore (x y z t a) :precision binary64 (+ x (/ (- t z) (/ a y))))
double code(double x, double y, double z, double t, double a) {
return x + ((t - z) / (a / y));
}
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 + ((t - z) / (a / y))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((t - z) / (a / y));
}
def code(x, y, z, t, a): return x + ((t - z) / (a / y))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(t - z) / Float64(a / y))) end
function tmp = code(x, y, z, t, a) tmp = x + ((t - z) / (a / y)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(t - z), $MachinePrecision] / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{t - z}{\frac{a}{y}}
\end{array}
Initial program 93.9%
associate-*l/97.3%
Simplified97.3%
*-commutative97.3%
clear-num97.3%
un-div-inv97.3%
Applied egg-rr97.3%
Final simplification97.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- z) (/ a y))))
(if (<= a -0.24)
x
(if (<= a -7.5e-224)
t_1
(if (<= a -1.08e-290)
(* t (/ y a))
(if (<= a 3e-201) t_1 (if (<= a 3.2e-71) (/ (* t y) a) x)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = -z / (a / y);
double tmp;
if (a <= -0.24) {
tmp = x;
} else if (a <= -7.5e-224) {
tmp = t_1;
} else if (a <= -1.08e-290) {
tmp = t * (y / a);
} else if (a <= 3e-201) {
tmp = t_1;
} else if (a <= 3.2e-71) {
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) :: t_1
real(8) :: tmp
t_1 = -z / (a / y)
if (a <= (-0.24d0)) then
tmp = x
else if (a <= (-7.5d-224)) then
tmp = t_1
else if (a <= (-1.08d-290)) then
tmp = t * (y / a)
else if (a <= 3d-201) then
tmp = t_1
else if (a <= 3.2d-71) 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 t_1 = -z / (a / y);
double tmp;
if (a <= -0.24) {
tmp = x;
} else if (a <= -7.5e-224) {
tmp = t_1;
} else if (a <= -1.08e-290) {
tmp = t * (y / a);
} else if (a <= 3e-201) {
tmp = t_1;
} else if (a <= 3.2e-71) {
tmp = (t * y) / a;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = -z / (a / y) tmp = 0 if a <= -0.24: tmp = x elif a <= -7.5e-224: tmp = t_1 elif a <= -1.08e-290: tmp = t * (y / a) elif a <= 3e-201: tmp = t_1 elif a <= 3.2e-71: tmp = (t * y) / a else: tmp = x return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(-z) / Float64(a / y)) tmp = 0.0 if (a <= -0.24) tmp = x; elseif (a <= -7.5e-224) tmp = t_1; elseif (a <= -1.08e-290) tmp = Float64(t * Float64(y / a)); elseif (a <= 3e-201) tmp = t_1; elseif (a <= 3.2e-71) tmp = Float64(Float64(t * y) / a); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = -z / (a / y); tmp = 0.0; if (a <= -0.24) tmp = x; elseif (a <= -7.5e-224) tmp = t_1; elseif (a <= -1.08e-290) tmp = t * (y / a); elseif (a <= 3e-201) tmp = t_1; elseif (a <= 3.2e-71) tmp = (t * y) / a; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[((-z) / N[(a / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -0.24], x, If[LessEqual[a, -7.5e-224], t$95$1, If[LessEqual[a, -1.08e-290], N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 3e-201], t$95$1, If[LessEqual[a, 3.2e-71], N[(N[(t * y), $MachinePrecision] / a), $MachinePrecision], x]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{-z}{\frac{a}{y}}\\
\mathbf{if}\;a \leq -0.24:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq -7.5 \cdot 10^{-224}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;a \leq -1.08 \cdot 10^{-290}:\\
\;\;\;\;t \cdot \frac{y}{a}\\
\mathbf{elif}\;a \leq 3 \cdot 10^{-201}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;a \leq 3.2 \cdot 10^{-71}:\\
\;\;\;\;\frac{t \cdot y}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -0.23999999999999999 or 3.1999999999999999e-71 < a Initial program 89.5%
associate-*l/97.9%
Simplified97.9%
Taylor expanded in z around inf 76.0%
associate-*l/77.0%
*-commutative77.0%
Simplified77.0%
Taylor expanded in x around inf 57.4%
if -0.23999999999999999 < a < -7.49999999999999978e-224 or -1.07999999999999997e-290 < a < 3.00000000000000002e-201Initial program 99.8%
associate-*l/97.4%
Simplified97.4%
Taylor expanded in z around inf 74.6%
associate-*l/77.3%
*-commutative77.3%
Simplified77.3%
Taylor expanded in x around 0 62.6%
mul-1-neg62.6%
*-commutative62.6%
associate-/l*65.1%
Simplified65.1%
if -7.49999999999999978e-224 < a < -1.07999999999999997e-290Initial program 99.9%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in z around 0 91.9%
associate-*r/91.9%
associate-*l*91.9%
neg-mul-191.9%
*-commutative91.9%
Simplified91.9%
Taylor expanded in x around 0 83.5%
associate-*r/83.6%
Simplified83.6%
if 3.00000000000000002e-201 < a < 3.1999999999999999e-71Initial program 99.9%
associate-*l/92.0%
Simplified92.0%
Taylor expanded in z around 0 73.9%
associate-*r/72.4%
associate-*l*72.4%
neg-mul-172.4%
*-commutative72.4%
Simplified72.4%
Taylor expanded in x around 0 53.3%
Final simplification60.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* z (/ (- y) a))))
(if (<= a -0.23)
x
(if (<= a -2.3e-222)
t_1
(if (<= a -6.1e-288)
(* t (/ y a))
(if (<= a 5.5e-201) t_1 (if (<= a 2.8e-72) (/ (* t y) a) x)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = z * (-y / a);
double tmp;
if (a <= -0.23) {
tmp = x;
} else if (a <= -2.3e-222) {
tmp = t_1;
} else if (a <= -6.1e-288) {
tmp = t * (y / a);
} else if (a <= 5.5e-201) {
tmp = t_1;
} else if (a <= 2.8e-72) {
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) :: t_1
real(8) :: tmp
t_1 = z * (-y / a)
if (a <= (-0.23d0)) then
tmp = x
else if (a <= (-2.3d-222)) then
tmp = t_1
else if (a <= (-6.1d-288)) then
tmp = t * (y / a)
else if (a <= 5.5d-201) then
tmp = t_1
else if (a <= 2.8d-72) 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 t_1 = z * (-y / a);
double tmp;
if (a <= -0.23) {
tmp = x;
} else if (a <= -2.3e-222) {
tmp = t_1;
} else if (a <= -6.1e-288) {
tmp = t * (y / a);
} else if (a <= 5.5e-201) {
tmp = t_1;
} else if (a <= 2.8e-72) {
tmp = (t * y) / a;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = z * (-y / a) tmp = 0 if a <= -0.23: tmp = x elif a <= -2.3e-222: tmp = t_1 elif a <= -6.1e-288: tmp = t * (y / a) elif a <= 5.5e-201: tmp = t_1 elif a <= 2.8e-72: tmp = (t * y) / a else: tmp = x return tmp
function code(x, y, z, t, a) t_1 = Float64(z * Float64(Float64(-y) / a)) tmp = 0.0 if (a <= -0.23) tmp = x; elseif (a <= -2.3e-222) tmp = t_1; elseif (a <= -6.1e-288) tmp = Float64(t * Float64(y / a)); elseif (a <= 5.5e-201) tmp = t_1; elseif (a <= 2.8e-72) tmp = Float64(Float64(t * y) / a); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = z * (-y / a); tmp = 0.0; if (a <= -0.23) tmp = x; elseif (a <= -2.3e-222) tmp = t_1; elseif (a <= -6.1e-288) tmp = t * (y / a); elseif (a <= 5.5e-201) tmp = t_1; elseif (a <= 2.8e-72) tmp = (t * y) / a; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(z * N[((-y) / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -0.23], x, If[LessEqual[a, -2.3e-222], t$95$1, If[LessEqual[a, -6.1e-288], N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 5.5e-201], t$95$1, If[LessEqual[a, 2.8e-72], N[(N[(t * y), $MachinePrecision] / a), $MachinePrecision], x]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \frac{-y}{a}\\
\mathbf{if}\;a \leq -0.23:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq -2.3 \cdot 10^{-222}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;a \leq -6.1 \cdot 10^{-288}:\\
\;\;\;\;t \cdot \frac{y}{a}\\
\mathbf{elif}\;a \leq 5.5 \cdot 10^{-201}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;a \leq 2.8 \cdot 10^{-72}:\\
\;\;\;\;\frac{t \cdot y}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -0.23000000000000001 or 2.7999999999999998e-72 < a Initial program 89.5%
associate-*l/97.9%
Simplified97.9%
Taylor expanded in z around inf 76.0%
associate-*l/77.0%
*-commutative77.0%
Simplified77.0%
Taylor expanded in x around inf 57.4%
if -0.23000000000000001 < a < -2.3000000000000001e-222 or -6.09999999999999982e-288 < a < 5.50000000000000034e-201Initial program 99.8%
associate-*l/97.4%
Simplified97.4%
Taylor expanded in z around inf 74.6%
associate-*l/77.3%
*-commutative77.3%
Simplified77.3%
Taylor expanded in x around 0 62.6%
mul-1-neg62.6%
associate-*r/57.8%
*-commutative57.8%
distribute-rgt-neg-in57.8%
associate-/r/65.1%
remove-double-neg65.1%
distribute-frac-neg65.1%
neg-mul-165.1%
neg-mul-165.1%
times-frac65.1%
metadata-eval65.1%
*-commutative65.1%
*-rgt-identity65.1%
distribute-frac-neg65.1%
associate-/r/57.8%
*-commutative57.8%
Simplified57.8%
Taylor expanded in y around 0 62.6%
mul-1-neg62.6%
associate-*l/65.2%
distribute-rgt-neg-out65.2%
Simplified65.2%
if -2.3000000000000001e-222 < a < -6.09999999999999982e-288Initial program 99.9%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in z around 0 91.9%
associate-*r/91.9%
associate-*l*91.9%
neg-mul-191.9%
*-commutative91.9%
Simplified91.9%
Taylor expanded in x around 0 83.5%
associate-*r/83.6%
Simplified83.6%
if 5.50000000000000034e-201 < a < 2.7999999999999998e-72Initial program 99.9%
associate-*l/92.0%
Simplified92.0%
Taylor expanded in z around 0 73.9%
associate-*r/72.4%
associate-*l*72.4%
neg-mul-172.4%
*-commutative72.4%
Simplified72.4%
Taylor expanded in x around 0 53.3%
Final simplification60.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -2.8e+120) (not (<= t 8e+18))) (+ 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.8e+120) || !(t <= 8e+18)) {
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.8d+120)) .or. (.not. (t <= 8d+18))) 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.8e+120) || !(t <= 8e+18)) {
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.8e+120) or not (t <= 8e+18): 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.8e+120) || !(t <= 8e+18)) 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.8e+120) || ~((t <= 8e+18))) 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.8e+120], N[Not[LessEqual[t, 8e+18]], $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.8 \cdot 10^{+120} \lor \neg \left(t \leq 8 \cdot 10^{+18}\right):\\
\;\;\;\;x + t \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x - z \cdot \frac{y}{a}\\
\end{array}
\end{array}
if t < -2.8000000000000001e120 or 8e18 < t Initial program 89.2%
associate-*l/98.9%
Simplified98.9%
Taylor expanded in z around 0 81.0%
associate-*r/90.7%
associate-*l*90.7%
neg-mul-190.7%
*-commutative90.7%
Simplified90.7%
sub-neg90.7%
+-commutative90.7%
distribute-rgt-neg-out90.7%
remove-double-neg90.7%
Applied egg-rr90.7%
if -2.8000000000000001e120 < t < 8e18Initial program 96.8%
associate-*l/96.3%
Simplified96.3%
Taylor expanded in z around inf 88.5%
associate-*l/91.0%
*-commutative91.0%
Simplified91.0%
Final simplification90.9%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.95e+164) (/ (- z) (/ a y)) (if (<= z 1.75e+230) (+ x (* t (/ y a))) (/ (* z (- y)) a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.95e+164) {
tmp = -z / (a / y);
} else if (z <= 1.75e+230) {
tmp = x + (t * (y / a));
} else {
tmp = (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 (z <= (-1.95d+164)) then
tmp = -z / (a / y)
else if (z <= 1.75d+230) then
tmp = x + (t * (y / a))
else
tmp = (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 (z <= -1.95e+164) {
tmp = -z / (a / y);
} else if (z <= 1.75e+230) {
tmp = x + (t * (y / a));
} else {
tmp = (z * -y) / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1.95e+164: tmp = -z / (a / y) elif z <= 1.75e+230: tmp = x + (t * (y / a)) else: tmp = (z * -y) / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.95e+164) tmp = Float64(Float64(-z) / Float64(a / y)); elseif (z <= 1.75e+230) tmp = Float64(x + Float64(t * Float64(y / a))); else tmp = Float64(Float64(z * Float64(-y)) / a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -1.95e+164) tmp = -z / (a / y); elseif (z <= 1.75e+230) tmp = x + (t * (y / a)); else tmp = (z * -y) / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.95e+164], N[((-z) / N[(a / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.75e+230], N[(x + N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z * (-y)), $MachinePrecision] / a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.95 \cdot 10^{+164}:\\
\;\;\;\;\frac{-z}{\frac{a}{y}}\\
\mathbf{elif}\;z \leq 1.75 \cdot 10^{+230}:\\
\;\;\;\;x + t \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{z \cdot \left(-y\right)}{a}\\
\end{array}
\end{array}
if z < -1.94999999999999993e164Initial program 96.9%
associate-*l/96.7%
Simplified96.7%
Taylor expanded in z around inf 93.8%
associate-*l/93.6%
*-commutative93.6%
Simplified93.6%
Taylor expanded in x around 0 77.4%
mul-1-neg77.4%
*-commutative77.4%
associate-/l*77.6%
Simplified77.6%
if -1.94999999999999993e164 < z < 1.75e230Initial program 93.9%
associate-*l/98.1%
Simplified98.1%
Taylor expanded in z around 0 73.6%
associate-*r/78.5%
associate-*l*78.5%
neg-mul-178.5%
*-commutative78.5%
Simplified78.5%
sub-neg78.5%
+-commutative78.5%
distribute-rgt-neg-out78.5%
remove-double-neg78.5%
Applied egg-rr78.5%
if 1.75e230 < z Initial program 88.4%
associate-*l/88.6%
Simplified88.6%
Taylor expanded in z around inf 88.4%
associate-*l/86.1%
*-commutative86.1%
Simplified86.1%
Taylor expanded in x around 0 71.0%
mul-1-neg71.0%
associate-*r/68.4%
*-commutative68.4%
distribute-rgt-neg-in68.4%
associate-/r/62.8%
remove-double-neg62.8%
distribute-frac-neg62.8%
neg-mul-162.8%
neg-mul-162.8%
times-frac62.8%
metadata-eval62.8%
*-commutative62.8%
*-rgt-identity62.8%
distribute-frac-neg62.8%
associate-/r/68.4%
*-commutative68.4%
Simplified68.4%
*-commutative68.4%
frac-2neg68.4%
remove-double-neg68.4%
associate-*l/71.0%
Applied egg-rr71.0%
Final simplification77.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -9.4e+119) (not (<= t 2.1e+19))) (* t (/ y a)) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -9.4e+119) || !(t <= 2.1e+19)) {
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 <= (-9.4d+119)) .or. (.not. (t <= 2.1d+19))) 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 <= -9.4e+119) || !(t <= 2.1e+19)) {
tmp = t * (y / a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -9.4e+119) or not (t <= 2.1e+19): tmp = t * (y / a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -9.4e+119) || !(t <= 2.1e+19)) 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 <= -9.4e+119) || ~((t <= 2.1e+19))) tmp = t * (y / a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -9.4e+119], N[Not[LessEqual[t, 2.1e+19]], $MachinePrecision]], N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -9.4 \cdot 10^{+119} \lor \neg \left(t \leq 2.1 \cdot 10^{+19}\right):\\
\;\;\;\;t \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -9.40000000000000016e119 or 2.1e19 < t Initial program 89.2%
associate-*l/98.9%
Simplified98.9%
Taylor expanded in z around 0 81.0%
associate-*r/90.7%
associate-*l*90.7%
neg-mul-190.7%
*-commutative90.7%
Simplified90.7%
Taylor expanded in x around 0 56.7%
associate-*r/65.4%
Simplified65.4%
if -9.40000000000000016e119 < t < 2.1e19Initial program 96.8%
associate-*l/96.3%
Simplified96.3%
Taylor expanded in z around inf 88.5%
associate-*l/91.0%
*-commutative91.0%
Simplified91.0%
Taylor expanded in x around inf 47.3%
Final simplification54.2%
(FPCore (x y z t a) :precision binary64 (if (<= t -2.3e+120) (* t (/ y a)) (if (<= t 1.35e+19) x (/ t (/ a y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -2.3e+120) {
tmp = t * (y / a);
} else if (t <= 1.35e+19) {
tmp = x;
} else {
tmp = t / (a / y);
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (t <= (-2.3d+120)) then
tmp = t * (y / a)
else if (t <= 1.35d+19) then
tmp = x
else
tmp = t / (a / y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -2.3e+120) {
tmp = t * (y / a);
} else if (t <= 1.35e+19) {
tmp = x;
} else {
tmp = t / (a / y);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -2.3e+120: tmp = t * (y / a) elif t <= 1.35e+19: tmp = x else: tmp = t / (a / y) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -2.3e+120) tmp = Float64(t * Float64(y / a)); elseif (t <= 1.35e+19) tmp = x; else tmp = Float64(t / Float64(a / y)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -2.3e+120) tmp = t * (y / a); elseif (t <= 1.35e+19) tmp = x; else tmp = t / (a / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -2.3e+120], N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.35e+19], x, N[(t / N[(a / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.3 \cdot 10^{+120}:\\
\;\;\;\;t \cdot \frac{y}{a}\\
\mathbf{elif}\;t \leq 1.35 \cdot 10^{+19}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{t}{\frac{a}{y}}\\
\end{array}
\end{array}
if t < -2.29999999999999993e120Initial program 87.5%
associate-*l/97.5%
Simplified97.5%
Taylor expanded in z around 0 78.7%
associate-*r/91.0%
associate-*l*91.0%
neg-mul-191.0%
*-commutative91.0%
Simplified91.0%
Taylor expanded in x around 0 61.6%
associate-*r/71.3%
Simplified71.3%
if -2.29999999999999993e120 < t < 1.35e19Initial program 96.8%
associate-*l/96.3%
Simplified96.3%
Taylor expanded in z around inf 88.5%
associate-*l/91.0%
*-commutative91.0%
Simplified91.0%
Taylor expanded in x around inf 47.3%
if 1.35e19 < t Initial program 90.3%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in z around 0 82.5%
associate-*r/90.5%
associate-*l*90.5%
neg-mul-190.5%
*-commutative90.5%
Simplified90.5%
Taylor expanded in x around 0 53.5%
associate-*r/61.5%
Simplified61.5%
associate-*r/53.5%
associate-/l*61.6%
Applied egg-rr61.6%
Final simplification54.2%
(FPCore (x y z t a) :precision binary64 (+ x (* (/ y a) (- t z))))
double code(double x, double y, double z, double t, double a) {
return x + ((y / a) * (t - z));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + ((y / a) * (t - z))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((y / a) * (t - z));
}
def code(x, y, z, t, a): return x + ((y / a) * (t - z))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(y / a) * Float64(t - z))) end
function tmp = code(x, y, z, t, a) tmp = x + ((y / a) * (t - z)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(y / a), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y}{a} \cdot \left(t - z\right)
\end{array}
Initial program 93.9%
associate-*l/97.3%
Simplified97.3%
Final simplification97.3%
(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.9%
associate-*l/97.3%
Simplified97.3%
Taylor expanded in z around inf 71.7%
associate-*l/73.8%
*-commutative73.8%
Simplified73.8%
Taylor expanded in x around inf 39.7%
Final simplification39.7%
(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 2023312
(FPCore (x y z t a)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, F"
:precision binary64
:herbie-target
(if (< y -1.0761266216389975e-10) (- x (/ 1.0 (/ (/ a (- z t)) y))) (if (< y 2.894426862792089e-49) (- x (/ (* y (- z t)) a)) (- x (/ y (/ a (- z t))))))
(- x (/ (* y (- z t)) a)))