
(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 10 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 (+ t (* (/ x y) (- z t))))
double code(double x, double y, double z, double t) {
return t + ((x / y) * (z - 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 + ((x / y) * (z - t))
end function
public static double code(double x, double y, double z, double t) {
return t + ((x / y) * (z - t));
}
def code(x, y, z, t): return t + ((x / y) * (z - t))
function code(x, y, z, t) return Float64(t + Float64(Float64(x / y) * Float64(z - t))) end
function tmp = code(x, y, z, t) tmp = t + ((x / y) * (z - t)); end
code[x_, y_, z_, t_] := N[(t + N[(N[(x / y), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
t + \frac{x}{y} \cdot \left(z - t\right)
\end{array}
Initial program 97.0%
Final simplification97.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (/ x y) z)) (t_2 (* (/ x y) (- t))))
(if (<= (/ x y) -2e+73)
t_2
(if (<= (/ x y) -5e-144)
t_1
(if (<= (/ x y) 1e-55)
t
(if (or (<= (/ x y) 5e+98) (not (<= (/ x y) 4e+203))) t_1 t_2))))))
double code(double x, double y, double z, double t) {
double t_1 = (x / y) * z;
double t_2 = (x / y) * -t;
double tmp;
if ((x / y) <= -2e+73) {
tmp = t_2;
} else if ((x / y) <= -5e-144) {
tmp = t_1;
} else if ((x / y) <= 1e-55) {
tmp = t;
} else if (((x / y) <= 5e+98) || !((x / y) <= 4e+203)) {
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 = (x / y) * -t
if ((x / y) <= (-2d+73)) then
tmp = t_2
else if ((x / y) <= (-5d-144)) then
tmp = t_1
else if ((x / y) <= 1d-55) then
tmp = t
else if (((x / y) <= 5d+98) .or. (.not. ((x / y) <= 4d+203))) 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 = (x / y) * -t;
double tmp;
if ((x / y) <= -2e+73) {
tmp = t_2;
} else if ((x / y) <= -5e-144) {
tmp = t_1;
} else if ((x / y) <= 1e-55) {
tmp = t;
} else if (((x / y) <= 5e+98) || !((x / y) <= 4e+203)) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x / y) * z t_2 = (x / y) * -t tmp = 0 if (x / y) <= -2e+73: tmp = t_2 elif (x / y) <= -5e-144: tmp = t_1 elif (x / y) <= 1e-55: tmp = t elif ((x / y) <= 5e+98) or not ((x / y) <= 4e+203): 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(x / y) * Float64(-t)) tmp = 0.0 if (Float64(x / y) <= -2e+73) tmp = t_2; elseif (Float64(x / y) <= -5e-144) tmp = t_1; elseif (Float64(x / y) <= 1e-55) tmp = t; elseif ((Float64(x / y) <= 5e+98) || !(Float64(x / y) <= 4e+203)) 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 = (x / y) * -t; tmp = 0.0; if ((x / y) <= -2e+73) tmp = t_2; elseif ((x / y) <= -5e-144) tmp = t_1; elseif ((x / y) <= 1e-55) tmp = t; elseif (((x / y) <= 5e+98) || ~(((x / y) <= 4e+203))) 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[(N[(x / y), $MachinePrecision] * (-t)), $MachinePrecision]}, If[LessEqual[N[(x / y), $MachinePrecision], -2e+73], t$95$2, If[LessEqual[N[(x / y), $MachinePrecision], -5e-144], t$95$1, If[LessEqual[N[(x / y), $MachinePrecision], 1e-55], t, If[Or[LessEqual[N[(x / y), $MachinePrecision], 5e+98], N[Not[LessEqual[N[(x / y), $MachinePrecision], 4e+203]], $MachinePrecision]], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{y} \cdot z\\
t_2 := \frac{x}{y} \cdot \left(-t\right)\\
\mathbf{if}\;\frac{x}{y} \leq -2 \cdot 10^{+73}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\frac{x}{y} \leq -5 \cdot 10^{-144}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{x}{y} \leq 10^{-55}:\\
\;\;\;\;t\\
\mathbf{elif}\;\frac{x}{y} \leq 5 \cdot 10^{+98} \lor \neg \left(\frac{x}{y} \leq 4 \cdot 10^{+203}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if (/.f64 x y) < -1.99999999999999997e73 or 4.9999999999999998e98 < (/.f64 x y) < 4e203Initial program 94.5%
Taylor expanded in z around 0 67.3%
mul-1-neg67.3%
associate-/l*69.0%
Simplified69.0%
+-commutative69.0%
unsub-neg69.0%
associate-/r/65.7%
Applied egg-rr65.7%
Taylor expanded in y around 0 67.3%
mul-1-neg67.3%
associate-*l/65.7%
distribute-rgt-neg-out65.7%
associate-*l/67.3%
associate-*r/69.1%
Simplified69.1%
if -1.99999999999999997e73 < (/.f64 x y) < -4.9999999999999998e-144 or 9.99999999999999995e-56 < (/.f64 x y) < 4.9999999999999998e98 or 4e203 < (/.f64 x y) Initial program 97.3%
*-commutative97.3%
clear-num97.1%
un-div-inv97.3%
Applied egg-rr97.3%
Taylor expanded in y around 0 89.9%
Taylor expanded in x around -inf 73.0%
Taylor expanded in z around inf 50.6%
associate-*l/60.2%
*-commutative60.2%
Simplified60.2%
if -4.9999999999999998e-144 < (/.f64 x y) < 9.99999999999999995e-56Initial program 98.1%
Taylor expanded in x around 0 83.9%
Final simplification70.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (/ x y) z)) (t_2 (* t (- 1.0 (/ x y)))))
(if (<= z -4.6e+72)
t_1
(if (<= z -6e+51)
t_2
(if (<= z -1.62e+19) (/ (* x z) y) (if (<= z 6.2e+102) t_2 t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = (x / y) * z;
double t_2 = t * (1.0 - (x / y));
double tmp;
if (z <= -4.6e+72) {
tmp = t_1;
} else if (z <= -6e+51) {
tmp = t_2;
} else if (z <= -1.62e+19) {
tmp = (x * z) / y;
} else if (z <= 6.2e+102) {
tmp = t_2;
} 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) :: t_2
real(8) :: tmp
t_1 = (x / y) * z
t_2 = t * (1.0d0 - (x / y))
if (z <= (-4.6d+72)) then
tmp = t_1
else if (z <= (-6d+51)) then
tmp = t_2
else if (z <= (-1.62d+19)) then
tmp = (x * z) / y
else if (z <= 6.2d+102) then
tmp = t_2
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;
double t_2 = t * (1.0 - (x / y));
double tmp;
if (z <= -4.6e+72) {
tmp = t_1;
} else if (z <= -6e+51) {
tmp = t_2;
} else if (z <= -1.62e+19) {
tmp = (x * z) / y;
} else if (z <= 6.2e+102) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x / y) * z t_2 = t * (1.0 - (x / y)) tmp = 0 if z <= -4.6e+72: tmp = t_1 elif z <= -6e+51: tmp = t_2 elif z <= -1.62e+19: tmp = (x * z) / y elif z <= 6.2e+102: tmp = t_2 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x / y) * z) t_2 = Float64(t * Float64(1.0 - Float64(x / y))) tmp = 0.0 if (z <= -4.6e+72) tmp = t_1; elseif (z <= -6e+51) tmp = t_2; elseif (z <= -1.62e+19) tmp = Float64(Float64(x * z) / y); elseif (z <= 6.2e+102) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x / y) * z; t_2 = t * (1.0 - (x / y)); tmp = 0.0; if (z <= -4.6e+72) tmp = t_1; elseif (z <= -6e+51) tmp = t_2; elseif (z <= -1.62e+19) tmp = (x * z) / y; elseif (z <= 6.2e+102) tmp = t_2; else tmp = t_1; 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[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -4.6e+72], t$95$1, If[LessEqual[z, -6e+51], t$95$2, If[LessEqual[z, -1.62e+19], N[(N[(x * z), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[z, 6.2e+102], t$95$2, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{y} \cdot z\\
t_2 := t \cdot \left(1 - \frac{x}{y}\right)\\
\mathbf{if}\;z \leq -4.6 \cdot 10^{+72}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -6 \cdot 10^{+51}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq -1.62 \cdot 10^{+19}:\\
\;\;\;\;\frac{x \cdot z}{y}\\
\mathbf{elif}\;z \leq 6.2 \cdot 10^{+102}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if z < -4.6e72 or 6.19999999999999973e102 < z Initial program 98.0%
*-commutative98.0%
clear-num96.0%
un-div-inv96.1%
Applied egg-rr96.1%
Taylor expanded in y around 0 90.3%
Taylor expanded in x around -inf 70.1%
Taylor expanded in z around inf 66.7%
associate-*l/73.7%
*-commutative73.7%
Simplified73.7%
if -4.6e72 < z < -6e51 or -1.62e19 < z < 6.19999999999999973e102Initial program 96.4%
Taylor expanded in z around 0 80.7%
mul-1-neg80.7%
unsub-neg80.7%
*-commutative80.7%
associate-*l/82.0%
cancel-sign-sub-inv82.0%
*-lft-identity82.0%
mul-1-neg82.0%
distribute-rgt-in82.0%
mul-1-neg82.0%
unsub-neg82.0%
Simplified82.0%
if -6e51 < z < -1.62e19Initial program 99.1%
*-commutative99.1%
clear-num99.1%
un-div-inv99.4%
Applied egg-rr99.4%
Taylor expanded in y around 0 99.4%
Taylor expanded in x around -inf 92.3%
Taylor expanded in z around inf 92.3%
Final simplification79.3%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -5e+55) (not (<= (/ x y) 2e-10))) (/ (* x (- z t)) y) (+ t (* (/ x y) z))))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -5e+55) || !((x / y) <= 2e-10)) {
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) <= (-5d+55)) .or. (.not. ((x / y) <= 2d-10))) 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) <= -5e+55) || !((x / y) <= 2e-10)) {
tmp = (x * (z - t)) / y;
} else {
tmp = t + ((x / y) * z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -5e+55) or not ((x / y) <= 2e-10): 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) <= -5e+55) || !(Float64(x / y) <= 2e-10)) tmp = Float64(Float64(x * 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) <= -5e+55) || ~(((x / y) <= 2e-10))) 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], -5e+55], N[Not[LessEqual[N[(x / y), $MachinePrecision], 2e-10]], $MachinePrecision]], N[(N[(x * N[(z - t), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], N[(t + N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -5 \cdot 10^{+55} \lor \neg \left(\frac{x}{y} \leq 2 \cdot 10^{-10}\right):\\
\;\;\;\;\frac{x \cdot \left(z - t\right)}{y}\\
\mathbf{else}:\\
\;\;\;\;t + \frac{x}{y} \cdot z\\
\end{array}
\end{array}
if (/.f64 x y) < -5.00000000000000046e55 or 2.00000000000000007e-10 < (/.f64 x y) Initial program 94.9%
*-commutative94.9%
clear-num94.8%
un-div-inv95.1%
Applied egg-rr95.1%
Taylor expanded in y around 0 96.5%
Taylor expanded in x around -inf 95.6%
if -5.00000000000000046e55 < (/.f64 x y) < 2.00000000000000007e-10Initial program 98.7%
Taylor expanded in z around inf 88.8%
associate-*l/94.8%
*-commutative94.8%
Simplified94.8%
Final simplification95.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (- z t))))
(if (<= (/ x y) -5e+55)
(* (/ 1.0 y) t_1)
(if (<= (/ x y) 2e-10) (+ t (* (/ x y) z)) (/ t_1 y)))))
double code(double x, double y, double z, double t) {
double t_1 = x * (z - t);
double tmp;
if ((x / y) <= -5e+55) {
tmp = (1.0 / y) * t_1;
} else if ((x / y) <= 2e-10) {
tmp = t + ((x / y) * z);
} else {
tmp = t_1 / 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 = x * (z - t)
if ((x / y) <= (-5d+55)) then
tmp = (1.0d0 / y) * t_1
else if ((x / y) <= 2d-10) then
tmp = t + ((x / y) * z)
else
tmp = t_1 / y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * (z - t);
double tmp;
if ((x / y) <= -5e+55) {
tmp = (1.0 / y) * t_1;
} else if ((x / y) <= 2e-10) {
tmp = t + ((x / y) * z);
} else {
tmp = t_1 / y;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (z - t) tmp = 0 if (x / y) <= -5e+55: tmp = (1.0 / y) * t_1 elif (x / y) <= 2e-10: tmp = t + ((x / y) * z) else: tmp = t_1 / y return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(z - t)) tmp = 0.0 if (Float64(x / y) <= -5e+55) tmp = Float64(Float64(1.0 / y) * t_1); elseif (Float64(x / y) <= 2e-10) tmp = Float64(t + Float64(Float64(x / y) * z)); else tmp = Float64(t_1 / y); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (z - t); tmp = 0.0; if ((x / y) <= -5e+55) tmp = (1.0 / y) * t_1; elseif ((x / y) <= 2e-10) tmp = t + ((x / y) * z); else tmp = t_1 / y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(z - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x / y), $MachinePrecision], -5e+55], N[(N[(1.0 / y), $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 2e-10], N[(t + N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(t$95$1 / y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(z - t\right)\\
\mathbf{if}\;\frac{x}{y} \leq -5 \cdot 10^{+55}:\\
\;\;\;\;\frac{1}{y} \cdot t_1\\
\mathbf{elif}\;\frac{x}{y} \leq 2 \cdot 10^{-10}:\\
\;\;\;\;t + \frac{x}{y} \cdot z\\
\mathbf{else}:\\
\;\;\;\;\frac{t_1}{y}\\
\end{array}
\end{array}
if (/.f64 x y) < -5.00000000000000046e55Initial program 93.4%
*-commutative93.4%
clear-num93.2%
un-div-inv93.8%
Applied egg-rr93.8%
Taylor expanded in y around 0 99.7%
Taylor expanded in x around -inf 99.7%
clear-num99.6%
associate-/r/99.7%
Applied egg-rr99.7%
if -5.00000000000000046e55 < (/.f64 x y) < 2.00000000000000007e-10Initial program 98.7%
Taylor expanded in z around inf 88.8%
associate-*l/94.8%
*-commutative94.8%
Simplified94.8%
if 2.00000000000000007e-10 < (/.f64 x y) Initial program 95.8%
*-commutative95.8%
clear-num95.8%
un-div-inv95.9%
Applied egg-rr95.9%
Taylor expanded in y around 0 94.5%
Taylor expanded in x around -inf 93.0%
Final simplification95.1%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -5e-144) (not (<= (/ x y) 1e-55))) (* (/ x y) z) t))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -5e-144) || !((x / y) <= 1e-55)) {
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) <= (-5d-144)) .or. (.not. ((x / y) <= 1d-55))) 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) <= -5e-144) || !((x / y) <= 1e-55)) {
tmp = (x / y) * z;
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -5e-144) or not ((x / y) <= 1e-55): tmp = (x / y) * z else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -5e-144) || !(Float64(x / y) <= 1e-55)) 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) <= -5e-144) || ~(((x / y) <= 1e-55))) tmp = (x / y) * z; else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -5e-144], N[Not[LessEqual[N[(x / y), $MachinePrecision], 1e-55]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision], t]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -5 \cdot 10^{-144} \lor \neg \left(\frac{x}{y} \leq 10^{-55}\right):\\
\;\;\;\;\frac{x}{y} \cdot z\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if (/.f64 x y) < -4.9999999999999998e-144 or 9.99999999999999995e-56 < (/.f64 x y) Initial program 96.4%
*-commutative96.4%
clear-num96.2%
un-div-inv96.5%
Applied egg-rr96.5%
Taylor expanded in y around 0 92.6%
Taylor expanded in x around -inf 81.3%
Taylor expanded in z around inf 48.4%
associate-*l/54.2%
*-commutative54.2%
Simplified54.2%
if -4.9999999999999998e-144 < (/.f64 x y) < 9.99999999999999995e-56Initial program 98.1%
Taylor expanded in x around 0 83.9%
Final simplification64.9%
(FPCore (x y z t) :precision binary64 (if (or (<= z -5.2e-138) (not (<= z 2.7e+69))) (+ t (* x (/ z y))) (* t (- 1.0 (/ x y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -5.2e-138) || !(z <= 2.7e+69)) {
tmp = t + (x * (z / y));
} else {
tmp = t * (1.0 - (x / 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) :: tmp
if ((z <= (-5.2d-138)) .or. (.not. (z <= 2.7d+69))) then
tmp = t + (x * (z / y))
else
tmp = t * (1.0d0 - (x / y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -5.2e-138) || !(z <= 2.7e+69)) {
tmp = t + (x * (z / y));
} else {
tmp = t * (1.0 - (x / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -5.2e-138) or not (z <= 2.7e+69): tmp = t + (x * (z / y)) else: tmp = t * (1.0 - (x / y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -5.2e-138) || !(z <= 2.7e+69)) tmp = Float64(t + Float64(x * Float64(z / y))); else tmp = Float64(t * Float64(1.0 - Float64(x / y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -5.2e-138) || ~((z <= 2.7e+69))) tmp = t + (x * (z / y)); else tmp = t * (1.0 - (x / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -5.2e-138], N[Not[LessEqual[z, 2.7e+69]], $MachinePrecision]], N[(t + N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.2 \cdot 10^{-138} \lor \neg \left(z \leq 2.7 \cdot 10^{+69}\right):\\
\;\;\;\;t + x \cdot \frac{z}{y}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\
\end{array}
\end{array}
if z < -5.2e-138 or 2.6999999999999998e69 < z Initial program 97.9%
*-commutative97.9%
clear-num96.6%
un-div-inv96.8%
Applied egg-rr96.8%
Taylor expanded in z around inf 85.7%
associate-*r/85.8%
Simplified85.8%
if -5.2e-138 < z < 2.6999999999999998e69Initial program 96.0%
Taylor expanded in z around 0 85.4%
mul-1-neg85.4%
unsub-neg85.4%
*-commutative85.4%
associate-*l/87.1%
cancel-sign-sub-inv87.1%
*-lft-identity87.1%
mul-1-neg87.1%
distribute-rgt-in87.1%
mul-1-neg87.1%
unsub-neg87.1%
Simplified87.1%
Final simplification86.4%
(FPCore (x y z t) :precision binary64 (if (or (<= z -5.2e-138) (not (<= z 2.5e+73))) (+ t (* (/ x y) z)) (* t (- 1.0 (/ x y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -5.2e-138) || !(z <= 2.5e+73)) {
tmp = t + ((x / y) * z);
} else {
tmp = t * (1.0 - (x / 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) :: tmp
if ((z <= (-5.2d-138)) .or. (.not. (z <= 2.5d+73))) then
tmp = t + ((x / y) * z)
else
tmp = t * (1.0d0 - (x / y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -5.2e-138) || !(z <= 2.5e+73)) {
tmp = t + ((x / y) * z);
} else {
tmp = t * (1.0 - (x / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -5.2e-138) or not (z <= 2.5e+73): tmp = t + ((x / y) * z) else: tmp = t * (1.0 - (x / y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -5.2e-138) || !(z <= 2.5e+73)) tmp = Float64(t + Float64(Float64(x / y) * z)); else tmp = Float64(t * Float64(1.0 - Float64(x / y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -5.2e-138) || ~((z <= 2.5e+73))) tmp = t + ((x / y) * z); else tmp = t * (1.0 - (x / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -5.2e-138], N[Not[LessEqual[z, 2.5e+73]], $MachinePrecision]], N[(t + N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.2 \cdot 10^{-138} \lor \neg \left(z \leq 2.5 \cdot 10^{+73}\right):\\
\;\;\;\;t + \frac{x}{y} \cdot z\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\
\end{array}
\end{array}
if z < -5.2e-138 or 2.49999999999999988e73 < z Initial program 97.9%
Taylor expanded in z around inf 85.7%
associate-*l/90.7%
*-commutative90.7%
Simplified90.7%
if -5.2e-138 < z < 2.49999999999999988e73Initial program 96.0%
Taylor expanded in z around 0 85.4%
mul-1-neg85.4%
unsub-neg85.4%
*-commutative85.4%
associate-*l/87.1%
cancel-sign-sub-inv87.1%
*-lft-identity87.1%
mul-1-neg87.1%
distribute-rgt-in87.1%
mul-1-neg87.1%
unsub-neg87.1%
Simplified87.1%
Final simplification89.0%
(FPCore (x y z t) :precision binary64 (if (<= z -2.52e-138) (+ t (/ z (/ y x))) (if (<= z 2.7e+69) (* t (- 1.0 (/ x y))) (+ t (* (/ x y) z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.52e-138) {
tmp = t + (z / (y / x));
} else if (z <= 2.7e+69) {
tmp = t * (1.0 - (x / 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 (z <= (-2.52d-138)) then
tmp = t + (z / (y / x))
else if (z <= 2.7d+69) then
tmp = t * (1.0d0 - (x / 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 (z <= -2.52e-138) {
tmp = t + (z / (y / x));
} else if (z <= 2.7e+69) {
tmp = t * (1.0 - (x / y));
} else {
tmp = t + ((x / y) * z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -2.52e-138: tmp = t + (z / (y / x)) elif z <= 2.7e+69: tmp = t * (1.0 - (x / y)) else: tmp = t + ((x / y) * z) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -2.52e-138) tmp = Float64(t + Float64(z / Float64(y / x))); elseif (z <= 2.7e+69) tmp = Float64(t * Float64(1.0 - Float64(x / 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 (z <= -2.52e-138) tmp = t + (z / (y / x)); elseif (z <= 2.7e+69) tmp = t * (1.0 - (x / y)); else tmp = t + ((x / y) * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -2.52e-138], N[(t + N[(z / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.7e+69], N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t + N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.52 \cdot 10^{-138}:\\
\;\;\;\;t + \frac{z}{\frac{y}{x}}\\
\mathbf{elif}\;z \leq 2.7 \cdot 10^{+69}:\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;t + \frac{x}{y} \cdot z\\
\end{array}
\end{array}
if z < -2.5199999999999999e-138Initial program 97.5%
*-commutative97.5%
clear-num97.4%
un-div-inv97.7%
Applied egg-rr97.7%
Taylor expanded in z around inf 82.4%
associate-*r/81.4%
Simplified81.4%
associate-*r/82.4%
*-commutative82.4%
associate-/l*85.9%
Applied egg-rr85.9%
if -2.5199999999999999e-138 < z < 2.6999999999999998e69Initial program 96.0%
Taylor expanded in z around 0 85.4%
mul-1-neg85.4%
unsub-neg85.4%
*-commutative85.4%
associate-*l/87.1%
cancel-sign-sub-inv87.1%
*-lft-identity87.1%
mul-1-neg87.1%
distribute-rgt-in87.1%
mul-1-neg87.1%
unsub-neg87.1%
Simplified87.1%
if 2.6999999999999998e69 < z Initial program 98.6%
Taylor expanded in z around inf 90.8%
associate-*l/98.6%
*-commutative98.6%
Simplified98.6%
Final simplification89.1%
(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 97.0%
Taylor expanded in x around 0 37.7%
Final simplification37.7%
(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 2023318
(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))