
(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 12 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 (if (<= (+ t (* (/ x y) (- z t))) 5e+307) (+ t (/ (- z t) (/ y x))) (/ (* x (- z t)) y)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t + ((x / y) * (z - t))) <= 5e+307) {
tmp = t + ((z - t) / (y / x));
} 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) :: tmp
if ((t + ((x / y) * (z - t))) <= 5d+307) then
tmp = t + ((z - t) / (y / x))
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 tmp;
if ((t + ((x / y) * (z - t))) <= 5e+307) {
tmp = t + ((z - t) / (y / x));
} else {
tmp = (x * (z - t)) / y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t + ((x / y) * (z - t))) <= 5e+307: tmp = t + ((z - t) / (y / x)) else: tmp = (x * (z - t)) / y return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(t + Float64(Float64(x / y) * Float64(z - t))) <= 5e+307) tmp = Float64(t + Float64(Float64(z - t) / Float64(y / x))); else tmp = Float64(Float64(x * Float64(z - t)) / y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t + ((x / y) * (z - t))) <= 5e+307) tmp = t + ((z - t) / (y / x)); else tmp = (x * (z - t)) / y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(t + N[(N[(x / y), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 5e+307], N[(t + N[(N[(z - t), $MachinePrecision] / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(z - t), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t + \frac{x}{y} \cdot \left(z - t\right) \leq 5 \cdot 10^{+307}:\\
\;\;\;\;t + \frac{z - t}{\frac{y}{x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \left(z - t\right)}{y}\\
\end{array}
\end{array}
if (+.f64 (*.f64 (/.f64 x y) (-.f64 z t)) t) < 5e307Initial program 98.4%
Taylor expanded in x around 0 93.9%
associate-*r/88.2%
*-commutative88.2%
associate-/r/98.5%
Simplified98.5%
if 5e307 < (+.f64 (*.f64 (/.f64 x y) (-.f64 z t)) t) Initial program 81.8%
Taylor expanded in x around 0 100.0%
Taylor expanded in x around -inf 100.0%
Final simplification98.7%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (+ t (* (/ x y) (- z t))))) (if (<= t_1 5e+307) 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+307) {
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+307) 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+307) {
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+307: 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+307) tmp = t_1; else tmp = Float64(Float64(x * 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+307) 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+307], t$95$1, N[(N[(x * N[(z - t), $MachinePrecision]), $MachinePrecision] / y), $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^{+307}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \left(z - t\right)}{y}\\
\end{array}
\end{array}
if (+.f64 (*.f64 (/.f64 x y) (-.f64 z t)) t) < 5e307Initial program 98.4%
if 5e307 < (+.f64 (*.f64 (/.f64 x y) (-.f64 z t)) t) Initial program 81.8%
Taylor expanded in x around 0 100.0%
Taylor expanded in x around -inf 100.0%
Final simplification98.7%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -5e+26) (not (<= (/ x y) 2e-8))) (* (/ x y) (- z t)) (+ t (/ (* x z) y))))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -5e+26) || !((x / y) <= 2e-8)) {
tmp = (x / y) * (z - t);
} else {
tmp = t + ((x * z) / 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 (((x / y) <= (-5d+26)) .or. (.not. ((x / y) <= 2d-8))) then
tmp = (x / y) * (z - t)
else
tmp = t + ((x * z) / y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -5e+26) || !((x / y) <= 2e-8)) {
tmp = (x / y) * (z - t);
} else {
tmp = t + ((x * z) / y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -5e+26) or not ((x / y) <= 2e-8): tmp = (x / y) * (z - t) else: tmp = t + ((x * z) / y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -5e+26) || !(Float64(x / y) <= 2e-8)) tmp = Float64(Float64(x / y) * Float64(z - t)); else tmp = Float64(t + Float64(Float64(x * z) / y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x / y) <= -5e+26) || ~(((x / y) <= 2e-8))) tmp = (x / y) * (z - t); else tmp = t + ((x * z) / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -5e+26], N[Not[LessEqual[N[(x / y), $MachinePrecision], 2e-8]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision], N[(t + N[(N[(x * z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -5 \cdot 10^{+26} \lor \neg \left(\frac{x}{y} \leq 2 \cdot 10^{-8}\right):\\
\;\;\;\;\frac{x}{y} \cdot \left(z - t\right)\\
\mathbf{else}:\\
\;\;\;\;t + \frac{x \cdot z}{y}\\
\end{array}
\end{array}
if (/.f64 x y) < -5.0000000000000001e26 or 2e-8 < (/.f64 x y) Initial program 92.8%
Taylor expanded in x around 0 92.8%
Taylor expanded in x around -inf 92.4%
Taylor expanded in z around 0 83.1%
fma-define83.1%
associate-*l/78.3%
*-commutative78.3%
associate-*r/79.1%
fma-define79.1%
neg-mul-179.1%
+-commutative79.1%
distribute-rgt-neg-in79.1%
mul-1-neg79.1%
distribute-lft-in85.0%
mul-1-neg85.0%
sub-neg85.0%
div-sub89.2%
*-commutative89.2%
associate-*l/92.4%
associate-/l*92.4%
Simplified92.4%
if -5.0000000000000001e26 < (/.f64 x y) < 2e-8Initial program 98.9%
Taylor expanded in z around inf 98.1%
Final simplification95.4%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -2e+28) (not (<= (/ x y) 2e-8))) (* (/ x y) (- z t)) (+ t (* (/ x y) z))))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -2e+28) || !((x / y) <= 2e-8)) {
tmp = (x / y) * (z - t);
} 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) <= (-2d+28)) .or. (.not. ((x / y) <= 2d-8))) then
tmp = (x / y) * (z - t)
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) <= -2e+28) || !((x / y) <= 2e-8)) {
tmp = (x / y) * (z - t);
} else {
tmp = t + ((x / y) * z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -2e+28) or not ((x / y) <= 2e-8): tmp = (x / y) * (z - t) else: tmp = t + ((x / y) * z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -2e+28) || !(Float64(x / y) <= 2e-8)) tmp = Float64(Float64(x / y) * Float64(z - t)); 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) <= -2e+28) || ~(((x / y) <= 2e-8))) tmp = (x / y) * (z - t); else tmp = t + ((x / y) * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -2e+28], N[Not[LessEqual[N[(x / y), $MachinePrecision], 2e-8]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision], N[(t + N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -2 \cdot 10^{+28} \lor \neg \left(\frac{x}{y} \leq 2 \cdot 10^{-8}\right):\\
\;\;\;\;\frac{x}{y} \cdot \left(z - t\right)\\
\mathbf{else}:\\
\;\;\;\;t + \frac{x}{y} \cdot z\\
\end{array}
\end{array}
if (/.f64 x y) < -1.99999999999999992e28 or 2e-8 < (/.f64 x y) Initial program 92.8%
Taylor expanded in x around 0 93.6%
Taylor expanded in x around -inf 93.1%
Taylor expanded in z around 0 83.7%
fma-define83.7%
associate-*l/78.9%
*-commutative78.9%
associate-*r/78.9%
fma-define78.9%
neg-mul-178.9%
+-commutative78.9%
distribute-rgt-neg-in78.9%
mul-1-neg78.9%
distribute-lft-in84.9%
mul-1-neg84.9%
sub-neg84.9%
div-sub89.1%
*-commutative89.1%
associate-*l/93.1%
associate-/l*92.3%
Simplified92.3%
if -1.99999999999999992e28 < (/.f64 x y) < 2e-8Initial program 99.0%
Taylor expanded in z around inf 97.8%
Final simplification95.3%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -2e+28) (not (<= (/ x y) 2e-8))) (* (/ x y) (- z t)) (+ t (* x (/ z y)))))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -2e+28) || !((x / y) <= 2e-8)) {
tmp = (x / y) * (z - t);
} else {
tmp = t + (x * (z / 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 (((x / y) <= (-2d+28)) .or. (.not. ((x / y) <= 2d-8))) then
tmp = (x / y) * (z - t)
else
tmp = t + (x * (z / y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -2e+28) || !((x / y) <= 2e-8)) {
tmp = (x / y) * (z - t);
} else {
tmp = t + (x * (z / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -2e+28) or not ((x / y) <= 2e-8): tmp = (x / y) * (z - t) else: tmp = t + (x * (z / y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -2e+28) || !(Float64(x / y) <= 2e-8)) tmp = Float64(Float64(x / y) * Float64(z - t)); else tmp = Float64(t + Float64(x * Float64(z / y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x / y) <= -2e+28) || ~(((x / y) <= 2e-8))) tmp = (x / y) * (z - t); else tmp = t + (x * (z / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -2e+28], N[Not[LessEqual[N[(x / y), $MachinePrecision], 2e-8]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision], N[(t + N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -2 \cdot 10^{+28} \lor \neg \left(\frac{x}{y} \leq 2 \cdot 10^{-8}\right):\\
\;\;\;\;\frac{x}{y} \cdot \left(z - t\right)\\
\mathbf{else}:\\
\;\;\;\;t + x \cdot \frac{z}{y}\\
\end{array}
\end{array}
if (/.f64 x y) < -1.99999999999999992e28 or 2e-8 < (/.f64 x y) Initial program 92.8%
Taylor expanded in x around 0 93.6%
Taylor expanded in x around -inf 93.1%
Taylor expanded in z around 0 83.7%
fma-define83.7%
associate-*l/78.9%
*-commutative78.9%
associate-*r/78.9%
fma-define78.9%
neg-mul-178.9%
+-commutative78.9%
distribute-rgt-neg-in78.9%
mul-1-neg78.9%
distribute-lft-in84.9%
mul-1-neg84.9%
sub-neg84.9%
div-sub89.1%
*-commutative89.1%
associate-*l/93.1%
associate-/l*92.3%
Simplified92.3%
if -1.99999999999999992e28 < (/.f64 x y) < 2e-8Initial program 99.0%
Taylor expanded in z around inf 97.4%
associate-/l*93.1%
Simplified93.1%
Final simplification92.7%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -5e-50) (not (<= (/ x y) 2e-26))) (* (/ x y) (- z t)) t))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -5e-50) || !((x / y) <= 2e-26)) {
tmp = (x / y) * (z - t);
} 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-50)) .or. (.not. ((x / y) <= 2d-26))) then
tmp = (x / y) * (z - t)
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-50) || !((x / y) <= 2e-26)) {
tmp = (x / y) * (z - t);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -5e-50) or not ((x / y) <= 2e-26): tmp = (x / y) * (z - t) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -5e-50) || !(Float64(x / y) <= 2e-26)) tmp = Float64(Float64(x / y) * Float64(z - t)); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x / y) <= -5e-50) || ~(((x / y) <= 2e-26))) tmp = (x / y) * (z - t); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -5e-50], N[Not[LessEqual[N[(x / y), $MachinePrecision], 2e-26]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision], t]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -5 \cdot 10^{-50} \lor \neg \left(\frac{x}{y} \leq 2 \cdot 10^{-26}\right):\\
\;\;\;\;\frac{x}{y} \cdot \left(z - t\right)\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if (/.f64 x y) < -4.99999999999999968e-50 or 2.0000000000000001e-26 < (/.f64 x y) Initial program 93.5%
Taylor expanded in x around 0 93.4%
Taylor expanded in x around -inf 88.8%
Taylor expanded in z around 0 80.4%
fma-define80.4%
associate-*l/76.1%
*-commutative76.1%
associate-*r/76.0%
fma-define76.0%
neg-mul-176.0%
+-commutative76.0%
distribute-rgt-neg-in76.0%
mul-1-neg76.0%
distribute-lft-in81.3%
mul-1-neg81.3%
sub-neg81.3%
div-sub85.2%
*-commutative85.2%
associate-*l/88.8%
associate-/l*88.9%
Simplified88.9%
if -4.99999999999999968e-50 < (/.f64 x y) < 2.0000000000000001e-26Initial program 98.9%
Taylor expanded in x around 0 82.5%
Final simplification85.8%
(FPCore (x y z t) :precision binary64 (if (<= (/ x y) -2e+28) (/ (* x (- z t)) y) (if (<= (/ x y) 2e-8) (+ t (* (/ x y) z)) (* (/ x y) (- z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -2e+28) {
tmp = (x * (z - t)) / y;
} else if ((x / y) <= 2e-8) {
tmp = t + ((x / y) * z);
} else {
tmp = (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) :: tmp
if ((x / y) <= (-2d+28)) then
tmp = (x * (z - t)) / y
else if ((x / y) <= 2d-8) then
tmp = t + ((x / y) * z)
else
tmp = (x / y) * (z - t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -2e+28) {
tmp = (x * (z - t)) / y;
} else if ((x / y) <= 2e-8) {
tmp = t + ((x / y) * z);
} else {
tmp = (x / y) * (z - t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -2e+28: tmp = (x * (z - t)) / y elif (x / y) <= 2e-8: tmp = t + ((x / y) * z) else: tmp = (x / y) * (z - t) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -2e+28) tmp = Float64(Float64(x * Float64(z - t)) / y); elseif (Float64(x / y) <= 2e-8) tmp = Float64(t + Float64(Float64(x / y) * z)); else tmp = Float64(Float64(x / y) * Float64(z - t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x / y) <= -2e+28) tmp = (x * (z - t)) / y; elseif ((x / y) <= 2e-8) tmp = t + ((x / y) * z); else tmp = (x / y) * (z - t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -2e+28], N[(N[(x * N[(z - t), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 2e-8], N[(t + N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -2 \cdot 10^{+28}:\\
\;\;\;\;\frac{x \cdot \left(z - t\right)}{y}\\
\mathbf{elif}\;\frac{x}{y} \leq 2 \cdot 10^{-8}:\\
\;\;\;\;t + \frac{x}{y} \cdot z\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} \cdot \left(z - t\right)\\
\end{array}
\end{array}
if (/.f64 x y) < -1.99999999999999992e28Initial program 87.8%
Taylor expanded in x around 0 95.9%
Taylor expanded in x around -inf 95.9%
if -1.99999999999999992e28 < (/.f64 x y) < 2e-8Initial program 99.0%
Taylor expanded in z around inf 97.8%
if 2e-8 < (/.f64 x y) Initial program 95.9%
Taylor expanded in x around 0 92.1%
Taylor expanded in x around -inf 91.3%
Taylor expanded in z around 0 82.9%
fma-define82.9%
associate-*l/75.1%
*-commutative75.1%
associate-*r/77.6%
fma-define77.6%
neg-mul-177.6%
+-commutative77.6%
distribute-rgt-neg-in77.6%
mul-1-neg77.6%
distribute-lft-in83.2%
mul-1-neg83.2%
sub-neg83.2%
div-sub87.4%
*-commutative87.4%
associate-*l/91.3%
associate-/l*95.2%
Simplified95.2%
Final simplification96.7%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.95e-193) (not (<= t 1e-127))) (* t (- 1.0 (/ x y))) (/ (* x z) y)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.95e-193) || !(t <= 1e-127)) {
tmp = t * (1.0 - (x / y));
} else {
tmp = (x * z) / 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 ((t <= (-1.95d-193)) .or. (.not. (t <= 1d-127))) then
tmp = t * (1.0d0 - (x / y))
else
tmp = (x * z) / y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.95e-193) || !(t <= 1e-127)) {
tmp = t * (1.0 - (x / y));
} else {
tmp = (x * z) / y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1.95e-193) or not (t <= 1e-127): tmp = t * (1.0 - (x / y)) else: tmp = (x * z) / y return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1.95e-193) || !(t <= 1e-127)) tmp = Float64(t * Float64(1.0 - Float64(x / y))); else tmp = Float64(Float64(x * z) / y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -1.95e-193) || ~((t <= 1e-127))) tmp = t * (1.0 - (x / y)); else tmp = (x * z) / y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.95e-193], N[Not[LessEqual[t, 1e-127]], $MachinePrecision]], N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * z), $MachinePrecision] / y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.95 \cdot 10^{-193} \lor \neg \left(t \leq 10^{-127}\right):\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot z}{y}\\
\end{array}
\end{array}
if t < -1.9499999999999999e-193 or 1e-127 < t Initial program 97.1%
Taylor expanded in z around 0 76.8%
*-rgt-identity76.8%
mul-1-neg76.8%
associate-/l*78.9%
distribute-rgt-neg-in78.9%
mul-1-neg78.9%
distribute-lft-in78.8%
mul-1-neg78.8%
unsub-neg78.8%
Simplified78.8%
if -1.9499999999999999e-193 < t < 1e-127Initial program 92.9%
Taylor expanded in x around 0 98.0%
Taylor expanded in x around -inf 77.5%
Taylor expanded in z around inf 66.5%
Final simplification76.0%
(FPCore (x y z t) :precision binary64 (if (<= x -8.8e+122) (* x (/ z y)) (if (<= x 6.5e+30) t (- (/ (* x t) y)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -8.8e+122) {
tmp = x * (z / y);
} else if (x <= 6.5e+30) {
tmp = t;
} else {
tmp = -((x * 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) :: tmp
if (x <= (-8.8d+122)) then
tmp = x * (z / y)
else if (x <= 6.5d+30) then
tmp = t
else
tmp = -((x * t) / y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -8.8e+122) {
tmp = x * (z / y);
} else if (x <= 6.5e+30) {
tmp = t;
} else {
tmp = -((x * t) / y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -8.8e+122: tmp = x * (z / y) elif x <= 6.5e+30: tmp = t else: tmp = -((x * t) / y) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -8.8e+122) tmp = Float64(x * Float64(z / y)); elseif (x <= 6.5e+30) tmp = t; else tmp = Float64(-Float64(Float64(x * t) / y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -8.8e+122) tmp = x * (z / y); elseif (x <= 6.5e+30) tmp = t; else tmp = -((x * t) / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -8.8e+122], N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 6.5e+30], t, (-N[(N[(x * t), $MachinePrecision] / y), $MachinePrecision])]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -8.8 \cdot 10^{+122}:\\
\;\;\;\;x \cdot \frac{z}{y}\\
\mathbf{elif}\;x \leq 6.5 \cdot 10^{+30}:\\
\;\;\;\;t\\
\mathbf{else}:\\
\;\;\;\;-\frac{x \cdot t}{y}\\
\end{array}
\end{array}
if x < -8.7999999999999997e122Initial program 93.1%
Taylor expanded in x around 0 86.4%
Taylor expanded in x around -inf 81.8%
Taylor expanded in z around inf 54.3%
associate-*r/55.7%
Simplified55.7%
if -8.7999999999999997e122 < x < 6.5e30Initial program 99.1%
Taylor expanded in x around 0 63.4%
if 6.5e30 < x Initial program 88.7%
Taylor expanded in x around 0 92.5%
Taylor expanded in x around -inf 90.8%
Taylor expanded in z around 0 66.4%
neg-mul-166.4%
Simplified66.4%
Final simplification62.7%
(FPCore (x y z t) :precision binary64 (if (<= x -8.2e+122) (* x (/ z y)) (if (<= x 1.45e+27) t (* (/ x y) (- t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -8.2e+122) {
tmp = x * (z / y);
} else if (x <= 1.45e+27) {
tmp = t;
} else {
tmp = (x / y) * -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 <= (-8.2d+122)) then
tmp = x * (z / y)
else if (x <= 1.45d+27) then
tmp = t
else
tmp = (x / y) * -t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -8.2e+122) {
tmp = x * (z / y);
} else if (x <= 1.45e+27) {
tmp = t;
} else {
tmp = (x / y) * -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -8.2e+122: tmp = x * (z / y) elif x <= 1.45e+27: tmp = t else: tmp = (x / y) * -t return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -8.2e+122) tmp = Float64(x * Float64(z / y)); elseif (x <= 1.45e+27) tmp = t; else tmp = Float64(Float64(x / y) * Float64(-t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -8.2e+122) tmp = x * (z / y); elseif (x <= 1.45e+27) tmp = t; else tmp = (x / y) * -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -8.2e+122], N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.45e+27], t, N[(N[(x / y), $MachinePrecision] * (-t)), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -8.2 \cdot 10^{+122}:\\
\;\;\;\;x \cdot \frac{z}{y}\\
\mathbf{elif}\;x \leq 1.45 \cdot 10^{+27}:\\
\;\;\;\;t\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} \cdot \left(-t\right)\\
\end{array}
\end{array}
if x < -8.2000000000000004e122Initial program 93.1%
Taylor expanded in x around 0 86.4%
Taylor expanded in x around -inf 81.8%
Taylor expanded in z around inf 54.3%
associate-*r/55.7%
Simplified55.7%
if -8.2000000000000004e122 < x < 1.4500000000000001e27Initial program 99.1%
Taylor expanded in x around 0 63.4%
if 1.4500000000000001e27 < x Initial program 88.7%
Taylor expanded in x around 0 92.5%
Taylor expanded in x around -inf 90.8%
Taylor expanded in z around 0 66.4%
mul-1-neg66.4%
associate-*r/63.1%
distribute-rgt-neg-out63.1%
distribute-neg-frac263.1%
Simplified63.1%
Final simplification62.1%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.18e+123) (not (<= x 4.8e+22))) (* x (/ z y)) t))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.18e+123) || !(x <= 4.8e+22)) {
tmp = x * (z / y);
} 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 <= (-1.18d+123)) .or. (.not. (x <= 4.8d+22))) then
tmp = x * (z / y)
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 <= -1.18e+123) || !(x <= 4.8e+22)) {
tmp = x * (z / y);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.18e+123) or not (x <= 4.8e+22): tmp = x * (z / y) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.18e+123) || !(x <= 4.8e+22)) tmp = Float64(x * Float64(z / y)); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -1.18e+123) || ~((x <= 4.8e+22))) tmp = x * (z / y); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.18e+123], N[Not[LessEqual[x, 4.8e+22]], $MachinePrecision]], N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision], t]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.18 \cdot 10^{+123} \lor \neg \left(x \leq 4.8 \cdot 10^{+22}\right):\\
\;\;\;\;x \cdot \frac{z}{y}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if x < -1.18000000000000006e123 or 4.8e22 < x Initial program 90.9%
Taylor expanded in x around 0 89.9%
Taylor expanded in x around -inf 87.0%
Taylor expanded in z around inf 46.8%
associate-*r/49.4%
Simplified49.4%
if -1.18000000000000006e123 < x < 4.8e22Initial program 99.1%
Taylor expanded in x around 0 64.2%
Final simplification58.7%
(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.1%
Taylor expanded in x around 0 43.4%
(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 2024176
(FPCore (x y z t)
:name "Numeric.Signal.Multichannel:$cget from hsignal-0.2.7.1"
:precision binary64
:alt
(! :herbie-platform default (if (< z 689864138640673/250000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (+ (* (/ x y) (- z t)) t) (if (< z 581748612718609/25000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (+ (* x (/ (- z t) y)) t) (+ (* (/ x y) (- z t)) t))))
(+ (* (/ x y) (- z t)) t))