
(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 (* (/ 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 92.8%
associate-*l/97.2%
Simplified97.2%
Final simplification97.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (/ y a) t)))
(if (<= a -1.52e+124)
x
(if (<= a 1.8e-276)
(* z (/ y (- a)))
(if (<= a 1.05e-182)
t_1
(if (<= a 2e-118) (/ (- y) (/ a z)) (if (<= a 3.3e-34) t_1 x)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y / a) * t;
double tmp;
if (a <= -1.52e+124) {
tmp = x;
} else if (a <= 1.8e-276) {
tmp = z * (y / -a);
} else if (a <= 1.05e-182) {
tmp = t_1;
} else if (a <= 2e-118) {
tmp = -y / (a / z);
} else if (a <= 3.3e-34) {
tmp = t_1;
} 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 = (y / a) * t
if (a <= (-1.52d+124)) then
tmp = x
else if (a <= 1.8d-276) then
tmp = z * (y / -a)
else if (a <= 1.05d-182) then
tmp = t_1
else if (a <= 2d-118) then
tmp = -y / (a / z)
else if (a <= 3.3d-34) then
tmp = t_1
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 = (y / a) * t;
double tmp;
if (a <= -1.52e+124) {
tmp = x;
} else if (a <= 1.8e-276) {
tmp = z * (y / -a);
} else if (a <= 1.05e-182) {
tmp = t_1;
} else if (a <= 2e-118) {
tmp = -y / (a / z);
} else if (a <= 3.3e-34) {
tmp = t_1;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y / a) * t tmp = 0 if a <= -1.52e+124: tmp = x elif a <= 1.8e-276: tmp = z * (y / -a) elif a <= 1.05e-182: tmp = t_1 elif a <= 2e-118: tmp = -y / (a / z) elif a <= 3.3e-34: tmp = t_1 else: tmp = x return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y / a) * t) tmp = 0.0 if (a <= -1.52e+124) tmp = x; elseif (a <= 1.8e-276) tmp = Float64(z * Float64(y / Float64(-a))); elseif (a <= 1.05e-182) tmp = t_1; elseif (a <= 2e-118) tmp = Float64(Float64(-y) / Float64(a / z)); elseif (a <= 3.3e-34) tmp = t_1; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y / a) * t; tmp = 0.0; if (a <= -1.52e+124) tmp = x; elseif (a <= 1.8e-276) tmp = z * (y / -a); elseif (a <= 1.05e-182) tmp = t_1; elseif (a <= 2e-118) tmp = -y / (a / z); elseif (a <= 3.3e-34) tmp = t_1; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y / a), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[a, -1.52e+124], x, If[LessEqual[a, 1.8e-276], N[(z * N[(y / (-a)), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 1.05e-182], t$95$1, If[LessEqual[a, 2e-118], N[((-y) / N[(a / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 3.3e-34], t$95$1, x]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{a} \cdot t\\
\mathbf{if}\;a \leq -1.52 \cdot 10^{+124}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 1.8 \cdot 10^{-276}:\\
\;\;\;\;z \cdot \frac{y}{-a}\\
\mathbf{elif}\;a \leq 1.05 \cdot 10^{-182}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;a \leq 2 \cdot 10^{-118}:\\
\;\;\;\;\frac{-y}{\frac{a}{z}}\\
\mathbf{elif}\;a \leq 3.3 \cdot 10^{-34}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -1.51999999999999998e124 or 3.29999999999999983e-34 < a Initial program 86.7%
associate-*l/96.6%
Simplified96.6%
Taylor expanded in x around inf 60.0%
if -1.51999999999999998e124 < a < 1.79999999999999997e-276Initial program 97.8%
associate-*l/97.7%
Simplified97.7%
Taylor expanded in z around inf 53.5%
mul-1-neg53.5%
associate-*l/56.7%
*-commutative56.7%
distribute-rgt-neg-in56.7%
*-lft-identity56.7%
associate-*l/56.6%
remove-double-neg56.6%
neg-mul-156.6%
associate-*r*56.6%
*-commutative56.6%
neg-mul-156.6%
*-commutative56.6%
distribute-neg-frac56.6%
metadata-eval56.6%
metadata-eval56.6%
associate-/r*56.6%
neg-mul-156.6%
associate-*r/56.7%
*-rgt-identity56.7%
distribute-frac-neg56.7%
remove-double-neg56.7%
Simplified56.7%
if 1.79999999999999997e-276 < a < 1.05e-182 or 1.99999999999999997e-118 < a < 3.29999999999999983e-34Initial program 99.9%
associate-*l/96.9%
Simplified96.9%
Taylor expanded in t around inf 68.0%
associate-*l/65.0%
div-inv65.1%
associate-*l*74.7%
associate-*l/74.7%
*-un-lft-identity74.7%
Applied egg-rr74.7%
if 1.05e-182 < a < 1.99999999999999997e-118Initial program 99.7%
associate-*l/99.8%
Simplified99.8%
Taylor expanded in z around inf 60.5%
mul-1-neg60.5%
associate-/l*60.5%
Simplified60.5%
Final simplification60.6%
(FPCore (x y z t a)
:precision binary64
(if (or (<= x -5.7e-24)
(and (not (<= x 6.2e-14)) (or (<= x 5.5e+77) (not (<= x 6e+187)))))
(+ x (* y (/ t a)))
(* (/ y a) (- t z))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x <= -5.7e-24) || (!(x <= 6.2e-14) && ((x <= 5.5e+77) || !(x <= 6e+187)))) {
tmp = x + (y * (t / 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 <= (-5.7d-24)) .or. (.not. (x <= 6.2d-14)) .and. (x <= 5.5d+77) .or. (.not. (x <= 6d+187))) then
tmp = x + (y * (t / 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 <= -5.7e-24) || (!(x <= 6.2e-14) && ((x <= 5.5e+77) || !(x <= 6e+187)))) {
tmp = x + (y * (t / a));
} else {
tmp = (y / a) * (t - z);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (x <= -5.7e-24) or (not (x <= 6.2e-14) and ((x <= 5.5e+77) or not (x <= 6e+187))): tmp = x + (y * (t / a)) else: tmp = (y / a) * (t - z) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((x <= -5.7e-24) || (!(x <= 6.2e-14) && ((x <= 5.5e+77) || !(x <= 6e+187)))) tmp = Float64(x + Float64(y * Float64(t / 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 <= -5.7e-24) || (~((x <= 6.2e-14)) && ((x <= 5.5e+77) || ~((x <= 6e+187))))) tmp = x + (y * (t / a)); else tmp = (y / a) * (t - z); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[x, -5.7e-24], And[N[Not[LessEqual[x, 6.2e-14]], $MachinePrecision], Or[LessEqual[x, 5.5e+77], N[Not[LessEqual[x, 6e+187]], $MachinePrecision]]]], N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y / a), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.7 \cdot 10^{-24} \lor \neg \left(x \leq 6.2 \cdot 10^{-14}\right) \land \left(x \leq 5.5 \cdot 10^{+77} \lor \neg \left(x \leq 6 \cdot 10^{+187}\right)\right):\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a} \cdot \left(t - z\right)\\
\end{array}
\end{array}
if x < -5.70000000000000002e-24 or 6.20000000000000009e-14 < x < 5.50000000000000036e77 or 5.9999999999999998e187 < x Initial program 91.9%
associate-*l/99.0%
Simplified99.0%
Taylor expanded in z around 0 85.0%
cancel-sign-sub-inv85.0%
metadata-eval85.0%
*-lft-identity85.0%
+-commutative85.0%
associate-/l*89.1%
associate-/r/86.0%
Simplified86.0%
if -5.70000000000000002e-24 < x < 6.20000000000000009e-14 or 5.50000000000000036e77 < x < 5.9999999999999998e187Initial program 93.5%
associate-/l*93.4%
Simplified93.4%
associate-/l*93.5%
clear-num93.4%
associate-/r/93.4%
Applied egg-rr93.4%
Taylor expanded in x around 0 79.0%
mul-1-neg79.0%
associate-/l*78.8%
associate-/r/81.4%
sub-neg81.4%
distribute-rgt-out74.0%
+-commutative74.0%
*-commutative74.0%
distribute-neg-in74.0%
*-commutative74.0%
distribute-lft-neg-in74.0%
remove-double-neg74.0%
sub-neg74.0%
distribute-rgt-out--81.4%
Simplified81.4%
Final simplification83.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (/ y a) (- t z))) (t_2 (+ x (/ y (/ a t)))))
(if (<= x -1.7e-21)
t_2
(if (<= x 2.15e-10)
t_1
(if (<= x 2.05e+77) t_2 (if (<= x 6e+187) t_1 (+ x (* y (/ t a)))))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y / a) * (t - z);
double t_2 = x + (y / (a / t));
double tmp;
if (x <= -1.7e-21) {
tmp = t_2;
} else if (x <= 2.15e-10) {
tmp = t_1;
} else if (x <= 2.05e+77) {
tmp = t_2;
} else if (x <= 6e+187) {
tmp = t_1;
} else {
tmp = x + (y * (t / a));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (y / a) * (t - z)
t_2 = x + (y / (a / t))
if (x <= (-1.7d-21)) then
tmp = t_2
else if (x <= 2.15d-10) then
tmp = t_1
else if (x <= 2.05d+77) then
tmp = t_2
else if (x <= 6d+187) then
tmp = t_1
else
tmp = x + (y * (t / a))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (y / a) * (t - z);
double t_2 = x + (y / (a / t));
double tmp;
if (x <= -1.7e-21) {
tmp = t_2;
} else if (x <= 2.15e-10) {
tmp = t_1;
} else if (x <= 2.05e+77) {
tmp = t_2;
} else if (x <= 6e+187) {
tmp = t_1;
} else {
tmp = x + (y * (t / a));
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y / a) * (t - z) t_2 = x + (y / (a / t)) tmp = 0 if x <= -1.7e-21: tmp = t_2 elif x <= 2.15e-10: tmp = t_1 elif x <= 2.05e+77: tmp = t_2 elif x <= 6e+187: tmp = t_1 else: tmp = x + (y * (t / a)) return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y / a) * Float64(t - z)) t_2 = Float64(x + Float64(y / Float64(a / t))) tmp = 0.0 if (x <= -1.7e-21) tmp = t_2; elseif (x <= 2.15e-10) tmp = t_1; elseif (x <= 2.05e+77) tmp = t_2; elseif (x <= 6e+187) tmp = t_1; else tmp = Float64(x + Float64(y * Float64(t / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y / a) * (t - z); t_2 = x + (y / (a / t)); tmp = 0.0; if (x <= -1.7e-21) tmp = t_2; elseif (x <= 2.15e-10) tmp = t_1; elseif (x <= 2.05e+77) tmp = t_2; elseif (x <= 6e+187) tmp = t_1; else tmp = x + (y * (t / a)); 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]}, Block[{t$95$2 = N[(x + N[(y / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.7e-21], t$95$2, If[LessEqual[x, 2.15e-10], t$95$1, If[LessEqual[x, 2.05e+77], t$95$2, If[LessEqual[x, 6e+187], t$95$1, N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{a} \cdot \left(t - z\right)\\
t_2 := x + \frac{y}{\frac{a}{t}}\\
\mathbf{if}\;x \leq -1.7 \cdot 10^{-21}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq 2.15 \cdot 10^{-10}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 2.05 \cdot 10^{+77}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq 6 \cdot 10^{+187}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\end{array}
\end{array}
if x < -1.7e-21 or 2.15000000000000007e-10 < x < 2.05e77Initial program 90.1%
associate-*l/98.6%
Simplified98.6%
Taylor expanded in z around 0 84.5%
cancel-sign-sub-inv84.5%
metadata-eval84.5%
*-lft-identity84.5%
+-commutative84.5%
associate-/l*87.6%
associate-/r/84.5%
Simplified84.5%
*-commutative84.5%
clear-num84.6%
un-div-inv85.8%
Applied egg-rr85.8%
if -1.7e-21 < x < 2.15000000000000007e-10 or 2.05e77 < x < 5.9999999999999998e187Initial program 93.5%
associate-/l*93.4%
Simplified93.4%
associate-/l*93.5%
clear-num93.4%
associate-/r/93.4%
Applied egg-rr93.4%
Taylor expanded in x around 0 79.0%
mul-1-neg79.0%
associate-/l*78.8%
associate-/r/81.4%
sub-neg81.4%
distribute-rgt-out74.0%
+-commutative74.0%
*-commutative74.0%
distribute-neg-in74.0%
*-commutative74.0%
distribute-lft-neg-in74.0%
remove-double-neg74.0%
sub-neg74.0%
distribute-rgt-out--81.4%
Simplified81.4%
if 5.9999999999999998e187 < x Initial program 96.6%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in z around 0 86.5%
cancel-sign-sub-inv86.5%
metadata-eval86.5%
*-lft-identity86.5%
+-commutative86.5%
associate-/l*93.4%
associate-/r/90.0%
Simplified90.0%
Final simplification83.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- y) (/ a z))))
(if (<= x -2.1e-21)
x
(if (<= x -2.25e-277)
t_1
(if (<= x 1.85e-187) (/ t (/ a y)) (if (<= x 0.00011) t_1 x))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = -y / (a / z);
double tmp;
if (x <= -2.1e-21) {
tmp = x;
} else if (x <= -2.25e-277) {
tmp = t_1;
} else if (x <= 1.85e-187) {
tmp = t / (a / y);
} else if (x <= 0.00011) {
tmp = t_1;
} 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 = -y / (a / z)
if (x <= (-2.1d-21)) then
tmp = x
else if (x <= (-2.25d-277)) then
tmp = t_1
else if (x <= 1.85d-187) then
tmp = t / (a / y)
else if (x <= 0.00011d0) then
tmp = t_1
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 = -y / (a / z);
double tmp;
if (x <= -2.1e-21) {
tmp = x;
} else if (x <= -2.25e-277) {
tmp = t_1;
} else if (x <= 1.85e-187) {
tmp = t / (a / y);
} else if (x <= 0.00011) {
tmp = t_1;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = -y / (a / z) tmp = 0 if x <= -2.1e-21: tmp = x elif x <= -2.25e-277: tmp = t_1 elif x <= 1.85e-187: tmp = t / (a / y) elif x <= 0.00011: tmp = t_1 else: tmp = x return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(-y) / Float64(a / z)) tmp = 0.0 if (x <= -2.1e-21) tmp = x; elseif (x <= -2.25e-277) tmp = t_1; elseif (x <= 1.85e-187) tmp = Float64(t / Float64(a / y)); elseif (x <= 0.00011) tmp = t_1; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = -y / (a / z); tmp = 0.0; if (x <= -2.1e-21) tmp = x; elseif (x <= -2.25e-277) tmp = t_1; elseif (x <= 1.85e-187) tmp = t / (a / y); elseif (x <= 0.00011) tmp = t_1; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[((-y) / N[(a / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.1e-21], x, If[LessEqual[x, -2.25e-277], t$95$1, If[LessEqual[x, 1.85e-187], N[(t / N[(a / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.00011], t$95$1, x]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{-y}{\frac{a}{z}}\\
\mathbf{if}\;x \leq -2.1 \cdot 10^{-21}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq -2.25 \cdot 10^{-277}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 1.85 \cdot 10^{-187}:\\
\;\;\;\;\frac{t}{\frac{a}{y}}\\
\mathbf{elif}\;x \leq 0.00011:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -2.10000000000000013e-21 or 1.10000000000000004e-4 < x Initial program 90.8%
associate-*l/98.4%
Simplified98.4%
Taylor expanded in x around inf 60.4%
if -2.10000000000000013e-21 < x < -2.24999999999999996e-277 or 1.85000000000000005e-187 < x < 1.10000000000000004e-4Initial program 94.8%
associate-*l/96.6%
Simplified96.6%
Taylor expanded in z around inf 52.9%
mul-1-neg52.9%
associate-/l*55.6%
Simplified55.6%
if -2.24999999999999996e-277 < x < 1.85000000000000005e-187Initial program 94.8%
associate-*l/94.7%
Simplified94.7%
Taylor expanded in t around inf 60.9%
associate-/l*63.5%
Simplified63.5%
Final simplification59.1%
(FPCore (x y z t a) :precision binary64 (if (<= a -3.4e+131) x (if (<= a 1.45e+133) (* (/ y a) (- t z)) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -3.4e+131) {
tmp = x;
} else if (a <= 1.45e+133) {
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.4d+131)) then
tmp = x
else if (a <= 1.45d+133) 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.4e+131) {
tmp = x;
} else if (a <= 1.45e+133) {
tmp = (y / a) * (t - z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -3.4e+131: tmp = x elif a <= 1.45e+133: tmp = (y / a) * (t - z) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -3.4e+131) tmp = x; elseif (a <= 1.45e+133) 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.4e+131) tmp = x; elseif (a <= 1.45e+133) tmp = (y / a) * (t - z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -3.4e+131], x, If[LessEqual[a, 1.45e+133], N[(N[(y / a), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -3.4 \cdot 10^{+131}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 1.45 \cdot 10^{+133}:\\
\;\;\;\;\frac{y}{a} \cdot \left(t - z\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -3.39999999999999986e131 or 1.4500000000000001e133 < a Initial program 82.0%
associate-*l/95.2%
Simplified95.2%
Taylor expanded in x around inf 69.2%
if -3.39999999999999986e131 < a < 1.4500000000000001e133Initial program 98.2%
associate-/l*93.1%
Simplified93.1%
associate-/l*98.2%
clear-num98.2%
associate-/r/98.2%
Applied egg-rr98.2%
Taylor expanded in x around 0 78.5%
mul-1-neg78.5%
associate-/l*74.5%
associate-/r/78.5%
sub-neg78.5%
distribute-rgt-out67.3%
+-commutative67.3%
*-commutative67.3%
distribute-neg-in67.3%
*-commutative67.3%
distribute-lft-neg-in67.3%
remove-double-neg67.3%
sub-neg67.3%
distribute-rgt-out--78.5%
Simplified78.5%
Final simplification75.4%
(FPCore (x y z t a) :precision binary64 (if (<= t -2.05e-45) (+ x (* y (/ t a))) (if (<= t 6.8e+37) (- x (/ (* y z) a)) (+ x (/ y (/ a t))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -2.05e-45) {
tmp = x + (y * (t / a));
} else if (t <= 6.8e+37) {
tmp = x - ((y * z) / a);
} else {
tmp = x + (y / (a / t));
}
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.05d-45)) then
tmp = x + (y * (t / a))
else if (t <= 6.8d+37) then
tmp = x - ((y * z) / a)
else
tmp = x + (y / (a / t))
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.05e-45) {
tmp = x + (y * (t / a));
} else if (t <= 6.8e+37) {
tmp = x - ((y * z) / a);
} else {
tmp = x + (y / (a / t));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -2.05e-45: tmp = x + (y * (t / a)) elif t <= 6.8e+37: tmp = x - ((y * z) / a) else: tmp = x + (y / (a / t)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -2.05e-45) tmp = Float64(x + Float64(y * Float64(t / a))); elseif (t <= 6.8e+37) tmp = Float64(x - Float64(Float64(y * z) / a)); else tmp = Float64(x + Float64(y / Float64(a / t))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -2.05e-45) tmp = x + (y * (t / a)); elseif (t <= 6.8e+37) tmp = x - ((y * z) / a); else tmp = x + (y / (a / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -2.05e-45], N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 6.8e+37], N[(x - N[(N[(y * z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.05 \cdot 10^{-45}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\mathbf{elif}\;t \leq 6.8 \cdot 10^{+37}:\\
\;\;\;\;x - \frac{y \cdot z}{a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{a}{t}}\\
\end{array}
\end{array}
if t < -2.05e-45Initial program 87.8%
associate-*l/98.4%
Simplified98.4%
Taylor expanded in z around 0 80.9%
cancel-sign-sub-inv80.9%
metadata-eval80.9%
*-lft-identity80.9%
+-commutative80.9%
associate-/l*86.2%
associate-/r/83.6%
Simplified83.6%
if -2.05e-45 < t < 6.80000000000000011e37Initial program 94.8%
associate-*l/95.6%
Simplified95.6%
Taylor expanded in z around inf 89.5%
if 6.80000000000000011e37 < t Initial program 94.6%
associate-*l/99.5%
Simplified99.5%
Taylor expanded in z around 0 80.9%
cancel-sign-sub-inv80.9%
metadata-eval80.9%
*-lft-identity80.9%
+-commutative80.9%
associate-/l*81.0%
associate-/r/77.8%
Simplified77.8%
*-commutative77.8%
clear-num77.8%
un-div-inv79.4%
Applied egg-rr79.4%
Final simplification85.6%
(FPCore (x y z t a) :precision binary64 (if (<= a -7e+124) x (if (<= a 3.3e-32) (* (/ y a) t) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -7e+124) {
tmp = x;
} else if (a <= 3.3e-32) {
tmp = (y / a) * t;
} 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 <= (-7d+124)) then
tmp = x
else if (a <= 3.3d-32) then
tmp = (y / a) * t
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 <= -7e+124) {
tmp = x;
} else if (a <= 3.3e-32) {
tmp = (y / a) * t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -7e+124: tmp = x elif a <= 3.3e-32: tmp = (y / a) * t else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -7e+124) tmp = x; elseif (a <= 3.3e-32) tmp = Float64(Float64(y / a) * t); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -7e+124) tmp = x; elseif (a <= 3.3e-32) tmp = (y / a) * t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -7e+124], x, If[LessEqual[a, 3.3e-32], N[(N[(y / a), $MachinePrecision] * t), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -7 \cdot 10^{+124}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 3.3 \cdot 10^{-32}:\\
\;\;\;\;\frac{y}{a} \cdot t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -7.0000000000000002e124 or 3.30000000000000025e-32 < a Initial program 86.5%
associate-*l/96.6%
Simplified96.6%
Taylor expanded in x around inf 60.4%
if -7.0000000000000002e124 < a < 3.30000000000000025e-32Initial program 98.5%
associate-*l/97.8%
Simplified97.8%
Taylor expanded in t around inf 45.4%
associate-*l/42.7%
div-inv42.6%
associate-*l*49.6%
associate-*l/49.6%
*-un-lft-identity49.6%
Applied egg-rr49.6%
Final simplification54.7%
(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/97.2%
Simplified97.2%
Taylor expanded in x around inf 37.5%
Final simplification37.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 2023333
(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)))