
(FPCore (x y z t) :precision binary64 (+ (* (/ x y) (- z t)) t))
double code(double x, double y, double z, double t) {
return ((x / y) * (z - t)) + t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((x / y) * (z - t)) + t
end function
public static double code(double x, double y, double z, double t) {
return ((x / y) * (z - t)) + t;
}
def code(x, y, z, t): return ((x / y) * (z - t)) + t
function code(x, y, z, t) return Float64(Float64(Float64(x / y) * Float64(z - t)) + t) end
function tmp = code(x, y, z, t) tmp = ((x / y) * (z - t)) + t; end
code[x_, y_, z_, t_] := N[(N[(N[(x / y), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{y} \cdot \left(z - t\right) + t
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ (* (/ x y) (- z t)) t))
double code(double x, double y, double z, double t) {
return ((x / y) * (z - t)) + t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((x / y) * (z - t)) + t
end function
public static double code(double x, double y, double z, double t) {
return ((x / y) * (z - t)) + t;
}
def code(x, y, z, t): return ((x / y) * (z - t)) + t
function code(x, y, z, t) return Float64(Float64(Float64(x / y) * Float64(z - t)) + t) end
function tmp = code(x, y, z, t) tmp = ((x / y) * (z - t)) + t; end
code[x_, y_, z_, t_] := N[(N[(N[(x / y), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{y} \cdot \left(z - t\right) + t
\end{array}
(FPCore (x y z t) :precision binary64 (let* ((t_1 (+ t (* (/ x y) (- z t))))) (if (<= t_1 5e+299) t_1 (+ t (/ x (/ y (- z t)))))))
double code(double x, double y, double z, double t) {
double t_1 = t + ((x / y) * (z - t));
double tmp;
if (t_1 <= 5e+299) {
tmp = t_1;
} else {
tmp = t + (x / (y / (z - t)));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = t + ((x / y) * (z - t))
if (t_1 <= 5d+299) then
tmp = t_1
else
tmp = t + (x / (y / (z - t)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = t + ((x / y) * (z - t));
double tmp;
if (t_1 <= 5e+299) {
tmp = t_1;
} else {
tmp = t + (x / (y / (z - t)));
}
return tmp;
}
def code(x, y, z, t): t_1 = t + ((x / y) * (z - t)) tmp = 0 if t_1 <= 5e+299: tmp = t_1 else: tmp = t + (x / (y / (z - t))) return tmp
function code(x, y, z, t) t_1 = Float64(t + Float64(Float64(x / y) * Float64(z - t))) tmp = 0.0 if (t_1 <= 5e+299) tmp = t_1; else tmp = Float64(t + Float64(x / Float64(y / Float64(z - t)))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = t + ((x / y) * (z - t)); tmp = 0.0; if (t_1 <= 5e+299) tmp = t_1; else tmp = t + (x / (y / (z - t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t + N[(N[(x / y), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 5e+299], t$95$1, N[(t + N[(x / N[(y / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t + \frac{x}{y} \cdot \left(z - t\right)\\
\mathbf{if}\;t_1 \leq 5 \cdot 10^{+299}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t + \frac{x}{\frac{y}{z - t}}\\
\end{array}
\end{array}
if (+.f64 (*.f64 (/.f64 x y) (-.f64 z t)) t) < 5.0000000000000003e299Initial program 98.4%
if 5.0000000000000003e299 < (+.f64 (*.f64 (/.f64 x y) (-.f64 z t)) t) Initial program 85.0%
associate-*l/97.3%
associate-/l*100.0%
Applied egg-rr100.0%
Final simplification98.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (/ x y) z)) (t_2 (/ (- t) (/ y x))))
(if (<= (/ x y) -2e+151)
t_1
(if (<= (/ x y) -2e+124)
t_2
(if (<= (/ x y) -1e+51)
t_1
(if (<= (/ x y) -1e+26)
t_2
(if (<= (/ x y) -20000.0)
t_1
(if (<= (/ x y) -1e-93)
t
(if (<= (/ x y) -3e-177)
t_1
(if (<= (/ x y) 5e-84)
t
(if (or (<= (/ x y) 5e+64) (not (<= (/ x y) 2e+191)))
t_1
t_2)))))))))))
double code(double x, double y, double z, double t) {
double t_1 = (x / y) * z;
double t_2 = -t / (y / x);
double tmp;
if ((x / y) <= -2e+151) {
tmp = t_1;
} else if ((x / y) <= -2e+124) {
tmp = t_2;
} else if ((x / y) <= -1e+51) {
tmp = t_1;
} else if ((x / y) <= -1e+26) {
tmp = t_2;
} else if ((x / y) <= -20000.0) {
tmp = t_1;
} else if ((x / y) <= -1e-93) {
tmp = t;
} else if ((x / y) <= -3e-177) {
tmp = t_1;
} else if ((x / y) <= 5e-84) {
tmp = t;
} else if (((x / y) <= 5e+64) || !((x / y) <= 2e+191)) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (x / y) * z
t_2 = -t / (y / x)
if ((x / y) <= (-2d+151)) then
tmp = t_1
else if ((x / y) <= (-2d+124)) then
tmp = t_2
else if ((x / y) <= (-1d+51)) then
tmp = t_1
else if ((x / y) <= (-1d+26)) then
tmp = t_2
else if ((x / y) <= (-20000.0d0)) then
tmp = t_1
else if ((x / y) <= (-1d-93)) then
tmp = t
else if ((x / y) <= (-3d-177)) then
tmp = t_1
else if ((x / y) <= 5d-84) then
tmp = t
else if (((x / y) <= 5d+64) .or. (.not. ((x / y) <= 2d+191))) then
tmp = t_1
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (x / y) * z;
double t_2 = -t / (y / x);
double tmp;
if ((x / y) <= -2e+151) {
tmp = t_1;
} else if ((x / y) <= -2e+124) {
tmp = t_2;
} else if ((x / y) <= -1e+51) {
tmp = t_1;
} else if ((x / y) <= -1e+26) {
tmp = t_2;
} else if ((x / y) <= -20000.0) {
tmp = t_1;
} else if ((x / y) <= -1e-93) {
tmp = t;
} else if ((x / y) <= -3e-177) {
tmp = t_1;
} else if ((x / y) <= 5e-84) {
tmp = t;
} else if (((x / y) <= 5e+64) || !((x / y) <= 2e+191)) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x / y) * z t_2 = -t / (y / x) tmp = 0 if (x / y) <= -2e+151: tmp = t_1 elif (x / y) <= -2e+124: tmp = t_2 elif (x / y) <= -1e+51: tmp = t_1 elif (x / y) <= -1e+26: tmp = t_2 elif (x / y) <= -20000.0: tmp = t_1 elif (x / y) <= -1e-93: tmp = t elif (x / y) <= -3e-177: tmp = t_1 elif (x / y) <= 5e-84: tmp = t elif ((x / y) <= 5e+64) or not ((x / y) <= 2e+191): tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x / y) * z) t_2 = Float64(Float64(-t) / Float64(y / x)) tmp = 0.0 if (Float64(x / y) <= -2e+151) tmp = t_1; elseif (Float64(x / y) <= -2e+124) tmp = t_2; elseif (Float64(x / y) <= -1e+51) tmp = t_1; elseif (Float64(x / y) <= -1e+26) tmp = t_2; elseif (Float64(x / y) <= -20000.0) tmp = t_1; elseif (Float64(x / y) <= -1e-93) tmp = t; elseif (Float64(x / y) <= -3e-177) tmp = t_1; elseif (Float64(x / y) <= 5e-84) tmp = t; elseif ((Float64(x / y) <= 5e+64) || !(Float64(x / y) <= 2e+191)) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x / y) * z; t_2 = -t / (y / x); tmp = 0.0; if ((x / y) <= -2e+151) tmp = t_1; elseif ((x / y) <= -2e+124) tmp = t_2; elseif ((x / y) <= -1e+51) tmp = t_1; elseif ((x / y) <= -1e+26) tmp = t_2; elseif ((x / y) <= -20000.0) tmp = t_1; elseif ((x / y) <= -1e-93) tmp = t; elseif ((x / y) <= -3e-177) tmp = t_1; elseif ((x / y) <= 5e-84) tmp = t; elseif (((x / y) <= 5e+64) || ~(((x / y) <= 2e+191))) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]}, Block[{t$95$2 = N[((-t) / N[(y / x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x / y), $MachinePrecision], -2e+151], t$95$1, If[LessEqual[N[(x / y), $MachinePrecision], -2e+124], t$95$2, If[LessEqual[N[(x / y), $MachinePrecision], -1e+51], t$95$1, If[LessEqual[N[(x / y), $MachinePrecision], -1e+26], t$95$2, If[LessEqual[N[(x / y), $MachinePrecision], -20000.0], t$95$1, If[LessEqual[N[(x / y), $MachinePrecision], -1e-93], t, If[LessEqual[N[(x / y), $MachinePrecision], -3e-177], t$95$1, If[LessEqual[N[(x / y), $MachinePrecision], 5e-84], t, If[Or[LessEqual[N[(x / y), $MachinePrecision], 5e+64], N[Not[LessEqual[N[(x / y), $MachinePrecision], 2e+191]], $MachinePrecision]], t$95$1, t$95$2]]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{y} \cdot z\\
t_2 := \frac{-t}{\frac{y}{x}}\\
\mathbf{if}\;\frac{x}{y} \leq -2 \cdot 10^{+151}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{x}{y} \leq -2 \cdot 10^{+124}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\frac{x}{y} \leq -1 \cdot 10^{+51}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{x}{y} \leq -1 \cdot 10^{+26}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\frac{x}{y} \leq -20000:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{x}{y} \leq -1 \cdot 10^{-93}:\\
\;\;\;\;t\\
\mathbf{elif}\;\frac{x}{y} \leq -3 \cdot 10^{-177}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{x}{y} \leq 5 \cdot 10^{-84}:\\
\;\;\;\;t\\
\mathbf{elif}\;\frac{x}{y} \leq 5 \cdot 10^{+64} \lor \neg \left(\frac{x}{y} \leq 2 \cdot 10^{+191}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if (/.f64 x y) < -2.00000000000000003e151 or -1.9999999999999999e124 < (/.f64 x y) < -1e51 or -1.00000000000000005e26 < (/.f64 x y) < -2e4 or -9.999999999999999e-94 < (/.f64 x y) < -3.00000000000000008e-177 or 5.0000000000000002e-84 < (/.f64 x y) < 5e64 or 2.00000000000000015e191 < (/.f64 x y) Initial program 94.7%
Taylor expanded in x around inf 86.0%
Taylor expanded in z around inf 62.1%
associate-*r/71.0%
Simplified71.0%
if -2.00000000000000003e151 < (/.f64 x y) < -1.9999999999999999e124 or -1e51 < (/.f64 x y) < -1.00000000000000005e26 or 5e64 < (/.f64 x y) < 2.00000000000000015e191Initial program 99.7%
Taylor expanded in x around inf 89.5%
Taylor expanded in z around 0 69.9%
mul-1-neg69.9%
associate-/l*74.9%
Simplified74.9%
if -2e4 < (/.f64 x y) < -9.999999999999999e-94 or -3.00000000000000008e-177 < (/.f64 x y) < 5.0000000000000002e-84Initial program 98.5%
Taylor expanded in x around 0 85.9%
Final simplification77.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* t (- 1.0 (/ x y))))
(t_2 (* (/ x y) z))
(t_3 (* x (/ (- z t) y))))
(if (<= (/ x y) -20000.0)
t_3
(if (<= (/ x y) -1e-93)
t_1
(if (<= (/ x y) -3e-177)
t_2
(if (<= (/ x y) 5e-84)
t_1
(if (<= (/ x y) 4e-47) t_2 (if (<= (/ x y) 2000.0) t_1 t_3))))))))
double code(double x, double y, double z, double t) {
double t_1 = t * (1.0 - (x / y));
double t_2 = (x / y) * z;
double t_3 = x * ((z - t) / y);
double tmp;
if ((x / y) <= -20000.0) {
tmp = t_3;
} else if ((x / y) <= -1e-93) {
tmp = t_1;
} else if ((x / y) <= -3e-177) {
tmp = t_2;
} else if ((x / y) <= 5e-84) {
tmp = t_1;
} else if ((x / y) <= 4e-47) {
tmp = t_2;
} else if ((x / y) <= 2000.0) {
tmp = t_1;
} else {
tmp = t_3;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_1 = t * (1.0d0 - (x / y))
t_2 = (x / y) * z
t_3 = x * ((z - t) / y)
if ((x / y) <= (-20000.0d0)) then
tmp = t_3
else if ((x / y) <= (-1d-93)) then
tmp = t_1
else if ((x / y) <= (-3d-177)) then
tmp = t_2
else if ((x / y) <= 5d-84) then
tmp = t_1
else if ((x / y) <= 4d-47) then
tmp = t_2
else if ((x / y) <= 2000.0d0) then
tmp = t_1
else
tmp = t_3
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = t * (1.0 - (x / y));
double t_2 = (x / y) * z;
double t_3 = x * ((z - t) / y);
double tmp;
if ((x / y) <= -20000.0) {
tmp = t_3;
} else if ((x / y) <= -1e-93) {
tmp = t_1;
} else if ((x / y) <= -3e-177) {
tmp = t_2;
} else if ((x / y) <= 5e-84) {
tmp = t_1;
} else if ((x / y) <= 4e-47) {
tmp = t_2;
} else if ((x / y) <= 2000.0) {
tmp = t_1;
} else {
tmp = t_3;
}
return tmp;
}
def code(x, y, z, t): t_1 = t * (1.0 - (x / y)) t_2 = (x / y) * z t_3 = x * ((z - t) / y) tmp = 0 if (x / y) <= -20000.0: tmp = t_3 elif (x / y) <= -1e-93: tmp = t_1 elif (x / y) <= -3e-177: tmp = t_2 elif (x / y) <= 5e-84: tmp = t_1 elif (x / y) <= 4e-47: tmp = t_2 elif (x / y) <= 2000.0: tmp = t_1 else: tmp = t_3 return tmp
function code(x, y, z, t) t_1 = Float64(t * Float64(1.0 - Float64(x / y))) t_2 = Float64(Float64(x / y) * z) t_3 = Float64(x * Float64(Float64(z - t) / y)) tmp = 0.0 if (Float64(x / y) <= -20000.0) tmp = t_3; elseif (Float64(x / y) <= -1e-93) tmp = t_1; elseif (Float64(x / y) <= -3e-177) tmp = t_2; elseif (Float64(x / y) <= 5e-84) tmp = t_1; elseif (Float64(x / y) <= 4e-47) tmp = t_2; elseif (Float64(x / y) <= 2000.0) tmp = t_1; else tmp = t_3; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = t * (1.0 - (x / y)); t_2 = (x / y) * z; t_3 = x * ((z - t) / y); tmp = 0.0; if ((x / y) <= -20000.0) tmp = t_3; elseif ((x / y) <= -1e-93) tmp = t_1; elseif ((x / y) <= -3e-177) tmp = t_2; elseif ((x / y) <= 5e-84) tmp = t_1; elseif ((x / y) <= 4e-47) tmp = t_2; elseif ((x / y) <= 2000.0) tmp = t_1; else tmp = t_3; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]}, Block[{t$95$3 = N[(x * N[(N[(z - t), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x / y), $MachinePrecision], -20000.0], t$95$3, If[LessEqual[N[(x / y), $MachinePrecision], -1e-93], t$95$1, If[LessEqual[N[(x / y), $MachinePrecision], -3e-177], t$95$2, If[LessEqual[N[(x / y), $MachinePrecision], 5e-84], t$95$1, If[LessEqual[N[(x / y), $MachinePrecision], 4e-47], t$95$2, If[LessEqual[N[(x / y), $MachinePrecision], 2000.0], t$95$1, t$95$3]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t \cdot \left(1 - \frac{x}{y}\right)\\
t_2 := \frac{x}{y} \cdot z\\
t_3 := x \cdot \frac{z - t}{y}\\
\mathbf{if}\;\frac{x}{y} \leq -20000:\\
\;\;\;\;t_3\\
\mathbf{elif}\;\frac{x}{y} \leq -1 \cdot 10^{-93}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{x}{y} \leq -3 \cdot 10^{-177}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\frac{x}{y} \leq 5 \cdot 10^{-84}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{x}{y} \leq 4 \cdot 10^{-47}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\frac{x}{y} \leq 2000:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_3\\
\end{array}
\end{array}
if (/.f64 x y) < -2e4 or 2e3 < (/.f64 x y) Initial program 95.2%
Taylor expanded in x around inf 92.2%
Taylor expanded in z around 0 92.2%
mul-1-neg92.2%
distribute-frac-neg92.2%
+-commutative92.2%
distribute-frac-neg92.2%
sub-neg92.2%
div-sub95.1%
Simplified95.1%
if -2e4 < (/.f64 x y) < -9.999999999999999e-94 or -3.00000000000000008e-177 < (/.f64 x y) < 5.0000000000000002e-84 or 3.9999999999999999e-47 < (/.f64 x y) < 2e3Initial program 98.6%
Taylor expanded in z around 0 80.4%
mul-1-neg80.4%
unsub-neg80.4%
associate-/l*84.9%
associate-/r/82.1%
Simplified82.1%
Taylor expanded in t around 0 84.9%
if -9.999999999999999e-94 < (/.f64 x y) < -3.00000000000000008e-177 or 5.0000000000000002e-84 < (/.f64 x y) < 3.9999999999999999e-47Initial program 99.6%
Taylor expanded in x around inf 73.7%
Taylor expanded in z around inf 70.8%
associate-*r/88.4%
Simplified88.4%
Final simplification90.6%
(FPCore (x y z t)
:precision binary64
(if (or (<= (/ x y) -20000.0)
(not
(or (<= (/ x y) -1e-93)
(and (not (<= (/ x y) -3e-177)) (<= (/ x y) 5e-84)))))
(* (/ x y) z)
t))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -20000.0) || !(((x / y) <= -1e-93) || (!((x / y) <= -3e-177) && ((x / y) <= 5e-84)))) {
tmp = (x / y) * z;
} else {
tmp = t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (((x / y) <= (-20000.0d0)) .or. (.not. ((x / y) <= (-1d-93)) .or. (.not. ((x / y) <= (-3d-177))) .and. ((x / y) <= 5d-84))) then
tmp = (x / y) * z
else
tmp = t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -20000.0) || !(((x / y) <= -1e-93) || (!((x / y) <= -3e-177) && ((x / y) <= 5e-84)))) {
tmp = (x / y) * z;
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -20000.0) or not (((x / y) <= -1e-93) or (not ((x / y) <= -3e-177) and ((x / y) <= 5e-84))): tmp = (x / y) * z else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -20000.0) || !((Float64(x / y) <= -1e-93) || (!(Float64(x / y) <= -3e-177) && (Float64(x / y) <= 5e-84)))) tmp = Float64(Float64(x / y) * z); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x / y) <= -20000.0) || ~((((x / y) <= -1e-93) || (~(((x / y) <= -3e-177)) && ((x / y) <= 5e-84))))) tmp = (x / y) * z; else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -20000.0], N[Not[Or[LessEqual[N[(x / y), $MachinePrecision], -1e-93], And[N[Not[LessEqual[N[(x / y), $MachinePrecision], -3e-177]], $MachinePrecision], LessEqual[N[(x / y), $MachinePrecision], 5e-84]]]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision], t]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -20000 \lor \neg \left(\frac{x}{y} \leq -1 \cdot 10^{-93} \lor \neg \left(\frac{x}{y} \leq -3 \cdot 10^{-177}\right) \land \frac{x}{y} \leq 5 \cdot 10^{-84}\right):\\
\;\;\;\;\frac{x}{y} \cdot z\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if (/.f64 x y) < -2e4 or -9.999999999999999e-94 < (/.f64 x y) < -3.00000000000000008e-177 or 5.0000000000000002e-84 < (/.f64 x y) Initial program 95.8%
Taylor expanded in x around inf 86.7%
Taylor expanded in z around inf 53.7%
associate-*r/61.8%
Simplified61.8%
if -2e4 < (/.f64 x y) < -9.999999999999999e-94 or -3.00000000000000008e-177 < (/.f64 x y) < 5.0000000000000002e-84Initial program 98.5%
Taylor expanded in x around 0 85.9%
Final simplification70.6%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (+ t (* (/ x y) (- z t))))) (if (<= t_1 5e+299) t_1 (* x (/ (- z t) y)))))
double code(double x, double y, double z, double t) {
double t_1 = t + ((x / y) * (z - t));
double tmp;
if (t_1 <= 5e+299) {
tmp = t_1;
} else {
tmp = x * ((z - t) / y);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = t + ((x / y) * (z - t))
if (t_1 <= 5d+299) then
tmp = t_1
else
tmp = x * ((z - t) / y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = t + ((x / y) * (z - t));
double tmp;
if (t_1 <= 5e+299) {
tmp = t_1;
} else {
tmp = x * ((z - t) / y);
}
return tmp;
}
def code(x, y, z, t): t_1 = t + ((x / y) * (z - t)) tmp = 0 if t_1 <= 5e+299: tmp = t_1 else: tmp = x * ((z - t) / y) return tmp
function code(x, y, z, t) t_1 = Float64(t + Float64(Float64(x / y) * Float64(z - t))) tmp = 0.0 if (t_1 <= 5e+299) tmp = t_1; else tmp = Float64(x * Float64(Float64(z - t) / y)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = t + ((x / y) * (z - t)); tmp = 0.0; if (t_1 <= 5e+299) tmp = t_1; else tmp = x * ((z - t) / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t + N[(N[(x / y), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 5e+299], t$95$1, N[(x * N[(N[(z - t), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t + \frac{x}{y} \cdot \left(z - t\right)\\
\mathbf{if}\;t_1 \leq 5 \cdot 10^{+299}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{z - t}{y}\\
\end{array}
\end{array}
if (+.f64 (*.f64 (/.f64 x y) (-.f64 z t)) t) < 5.0000000000000003e299Initial program 98.4%
if 5.0000000000000003e299 < (+.f64 (*.f64 (/.f64 x y) (-.f64 z t)) t) Initial program 85.0%
Taylor expanded in x around inf 99.9%
Taylor expanded in z around 0 99.9%
mul-1-neg99.9%
distribute-frac-neg99.9%
+-commutative99.9%
distribute-frac-neg99.9%
sub-neg99.9%
div-sub99.9%
Simplified99.9%
Final simplification98.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* t (- 1.0 (/ x y)))))
(if (<= t -3.2e+26)
t_1
(if (<= t -2.05e-50)
(* (/ x y) z)
(if (or (<= t -3e-82) (not (<= t 1.18e-150))) t_1 (/ x (/ y z)))))))
double code(double x, double y, double z, double t) {
double t_1 = t * (1.0 - (x / y));
double tmp;
if (t <= -3.2e+26) {
tmp = t_1;
} else if (t <= -2.05e-50) {
tmp = (x / y) * z;
} else if ((t <= -3e-82) || !(t <= 1.18e-150)) {
tmp = t_1;
} else {
tmp = x / (y / z);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = t * (1.0d0 - (x / y))
if (t <= (-3.2d+26)) then
tmp = t_1
else if (t <= (-2.05d-50)) then
tmp = (x / y) * z
else if ((t <= (-3d-82)) .or. (.not. (t <= 1.18d-150))) then
tmp = t_1
else
tmp = x / (y / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = t * (1.0 - (x / y));
double tmp;
if (t <= -3.2e+26) {
tmp = t_1;
} else if (t <= -2.05e-50) {
tmp = (x / y) * z;
} else if ((t <= -3e-82) || !(t <= 1.18e-150)) {
tmp = t_1;
} else {
tmp = x / (y / z);
}
return tmp;
}
def code(x, y, z, t): t_1 = t * (1.0 - (x / y)) tmp = 0 if t <= -3.2e+26: tmp = t_1 elif t <= -2.05e-50: tmp = (x / y) * z elif (t <= -3e-82) or not (t <= 1.18e-150): tmp = t_1 else: tmp = x / (y / z) return tmp
function code(x, y, z, t) t_1 = Float64(t * Float64(1.0 - Float64(x / y))) tmp = 0.0 if (t <= -3.2e+26) tmp = t_1; elseif (t <= -2.05e-50) tmp = Float64(Float64(x / y) * z); elseif ((t <= -3e-82) || !(t <= 1.18e-150)) tmp = t_1; else tmp = Float64(x / Float64(y / z)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = t * (1.0 - (x / y)); tmp = 0.0; if (t <= -3.2e+26) tmp = t_1; elseif (t <= -2.05e-50) tmp = (x / y) * z; elseif ((t <= -3e-82) || ~((t <= 1.18e-150))) tmp = t_1; else tmp = x / (y / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -3.2e+26], t$95$1, If[LessEqual[t, -2.05e-50], N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision], If[Or[LessEqual[t, -3e-82], N[Not[LessEqual[t, 1.18e-150]], $MachinePrecision]], t$95$1, N[(x / N[(y / z), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t \cdot \left(1 - \frac{x}{y}\right)\\
\mathbf{if}\;t \leq -3.2 \cdot 10^{+26}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq -2.05 \cdot 10^{-50}:\\
\;\;\;\;\frac{x}{y} \cdot z\\
\mathbf{elif}\;t \leq -3 \cdot 10^{-82} \lor \neg \left(t \leq 1.18 \cdot 10^{-150}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{y}{z}}\\
\end{array}
\end{array}
if t < -3.20000000000000029e26 or -2.04999999999999993e-50 < t < -2.9999999999999999e-82 or 1.18e-150 < t Initial program 99.0%
Taylor expanded in z around 0 76.8%
mul-1-neg76.8%
unsub-neg76.8%
associate-/l*81.0%
associate-/r/78.5%
Simplified78.5%
Taylor expanded in t around 0 81.0%
if -3.20000000000000029e26 < t < -2.04999999999999993e-50Initial program 95.1%
Taylor expanded in x around inf 78.9%
Taylor expanded in z around inf 63.3%
associate-*r/74.2%
Simplified74.2%
if -2.9999999999999999e-82 < t < 1.18e-150Initial program 93.1%
Taylor expanded in x around inf 78.1%
Taylor expanded in z around inf 63.1%
*-commutative63.1%
associate-/l*69.8%
Simplified69.8%
Final simplification76.8%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -1e+26) (not (<= (/ x y) 5.0))) (* x (/ (- z t) y)) (+ t (* (/ x y) z))))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -1e+26) || !((x / y) <= 5.0)) {
tmp = x * ((z - t) / y);
} else {
tmp = t + ((x / y) * z);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (((x / y) <= (-1d+26)) .or. (.not. ((x / y) <= 5.0d0))) then
tmp = x * ((z - t) / y)
else
tmp = t + ((x / y) * z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -1e+26) || !((x / y) <= 5.0)) {
tmp = x * ((z - t) / y);
} else {
tmp = t + ((x / y) * z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -1e+26) or not ((x / y) <= 5.0): tmp = x * ((z - t) / y) else: tmp = t + ((x / y) * z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -1e+26) || !(Float64(x / y) <= 5.0)) tmp = Float64(x * Float64(Float64(z - t) / y)); else tmp = Float64(t + Float64(Float64(x / y) * z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x / y) <= -1e+26) || ~(((x / y) <= 5.0))) tmp = x * ((z - t) / y); else tmp = t + ((x / y) * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -1e+26], N[Not[LessEqual[N[(x / y), $MachinePrecision], 5.0]], $MachinePrecision]], N[(x * N[(N[(z - t), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(t + N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -1 \cdot 10^{+26} \lor \neg \left(\frac{x}{y} \leq 5\right):\\
\;\;\;\;x \cdot \frac{z - t}{y}\\
\mathbf{else}:\\
\;\;\;\;t + \frac{x}{y} \cdot z\\
\end{array}
\end{array}
if (/.f64 x y) < -1.00000000000000005e26 or 5 < (/.f64 x y) Initial program 95.1%
Taylor expanded in x around inf 91.8%
Taylor expanded in z around 0 91.8%
mul-1-neg91.8%
distribute-frac-neg91.8%
+-commutative91.8%
distribute-frac-neg91.8%
sub-neg91.8%
div-sub94.7%
Simplified94.7%
if -1.00000000000000005e26 < (/.f64 x y) < 5Initial program 98.7%
Taylor expanded in z around inf 93.6%
associate-*r/98.1%
Simplified98.1%
Final simplification96.3%
(FPCore (x y z t) :precision binary64 t)
double code(double x, double y, double z, double t) {
return t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = t
end function
public static double code(double x, double y, double z, double t) {
return t;
}
def code(x, y, z, t): return t
function code(x, y, z, t) return t end
function tmp = code(x, y, z, t) tmp = t; end
code[x_, y_, z_, t_] := t
\begin{array}{l}
\\
t
\end{array}
Initial program 96.8%
Taylor expanded in x around 0 35.5%
Final simplification35.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ (* (/ x y) (- z t)) t)))
(if (< z 2.759456554562692e-282)
t_1
(if (< z 2.326994450874436e-110) (+ (* x (/ (- z t) y)) t) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = ((x / y) * (z - t)) + t;
double tmp;
if (z < 2.759456554562692e-282) {
tmp = t_1;
} else if (z < 2.326994450874436e-110) {
tmp = (x * ((z - t) / y)) + t;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = ((x / y) * (z - t)) + t
if (z < 2.759456554562692d-282) then
tmp = t_1
else if (z < 2.326994450874436d-110) then
tmp = (x * ((z - t) / y)) + t
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = ((x / y) * (z - t)) + t;
double tmp;
if (z < 2.759456554562692e-282) {
tmp = t_1;
} else if (z < 2.326994450874436e-110) {
tmp = (x * ((z - t) / y)) + t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = ((x / y) * (z - t)) + t tmp = 0 if z < 2.759456554562692e-282: tmp = t_1 elif z < 2.326994450874436e-110: tmp = (x * ((z - t) / y)) + t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(Float64(x / y) * Float64(z - t)) + t) tmp = 0.0 if (z < 2.759456554562692e-282) tmp = t_1; elseif (z < 2.326994450874436e-110) tmp = Float64(Float64(x * Float64(Float64(z - t) / y)) + t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = ((x / y) * (z - t)) + t; tmp = 0.0; if (z < 2.759456554562692e-282) tmp = t_1; elseif (z < 2.326994450874436e-110) tmp = (x * ((z - t) / y)) + t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[(x / y), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]}, If[Less[z, 2.759456554562692e-282], t$95$1, If[Less[z, 2.326994450874436e-110], N[(N[(x * N[(N[(z - t), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{y} \cdot \left(z - t\right) + t\\
\mathbf{if}\;z < 2.759456554562692 \cdot 10^{-282}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z < 2.326994450874436 \cdot 10^{-110}:\\
\;\;\;\;x \cdot \frac{z - t}{y} + t\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
herbie shell --seed 2023238
(FPCore (x y z t)
:name "Numeric.Signal.Multichannel:$cget from hsignal-0.2.7.1"
:precision binary64
:herbie-target
(if (< z 2.759456554562692e-282) (+ (* (/ x y) (- z t)) t) (if (< z 2.326994450874436e-110) (+ (* x (/ (- z t) y)) t) (+ (* (/ x y) (- z t)) t)))
(+ (* (/ x y) (- z t)) t))