
(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 (fma (/ x y) (- z t) t))
double code(double x, double y, double z, double t) {
return fma((x / y), (z - t), t);
}
function code(x, y, z, t) return fma(Float64(x / y), Float64(z - t), t) end
code[x_, y_, z_, t_] := N[(N[(x / y), $MachinePrecision] * N[(z - t), $MachinePrecision] + t), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{x}{y}, z - t, t\right)
\end{array}
Initial program 97.9%
fma-def97.9%
Simplified97.9%
Final simplification97.9%
(FPCore (x y z t) :precision binary64 (if (<= (/ x y) -500.0) (/ (* x (- z t)) y) (if (<= (/ x y) 4e-26) (+ t (* (/ x y) z)) (+ t (* x (/ (- z t) y))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -500.0) {
tmp = (x * (z - t)) / y;
} else if ((x / y) <= 4e-26) {
tmp = t + ((x / y) * z);
} else {
tmp = t + (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 ((x / y) <= (-500.0d0)) then
tmp = (x * (z - t)) / y
else if ((x / y) <= 4d-26) then
tmp = t + ((x / y) * z)
else
tmp = t + (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 ((x / y) <= -500.0) {
tmp = (x * (z - t)) / y;
} else if ((x / y) <= 4e-26) {
tmp = t + ((x / y) * z);
} else {
tmp = t + (x * ((z - t) / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -500.0: tmp = (x * (z - t)) / y elif (x / y) <= 4e-26: tmp = t + ((x / y) * z) else: tmp = t + (x * ((z - t) / y)) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -500.0) tmp = Float64(Float64(x * Float64(z - t)) / y); elseif (Float64(x / y) <= 4e-26) tmp = Float64(t + Float64(Float64(x / y) * z)); else tmp = Float64(t + Float64(x * Float64(Float64(z - t) / y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x / y) <= -500.0) tmp = (x * (z - t)) / y; elseif ((x / y) <= 4e-26) tmp = t + ((x / y) * z); else tmp = t + (x * ((z - t) / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -500.0], N[(N[(x * N[(z - t), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 4e-26], N[(t + N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(t + N[(x * N[(N[(z - t), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -500:\\
\;\;\;\;\frac{x \cdot \left(z - t\right)}{y}\\
\mathbf{elif}\;\frac{x}{y} \leq 4 \cdot 10^{-26}:\\
\;\;\;\;t + \frac{x}{y} \cdot z\\
\mathbf{else}:\\
\;\;\;\;t + x \cdot \frac{z - t}{y}\\
\end{array}
\end{array}
if (/.f64 x y) < -500Initial program 94.0%
Taylor expanded in x around 0 97.9%
Taylor expanded in x around -inf 94.8%
if -500 < (/.f64 x y) < 4.0000000000000002e-26Initial program 99.0%
Taylor expanded in z around inf 95.1%
associate-*r/99.0%
Simplified99.0%
if 4.0000000000000002e-26 < (/.f64 x y) Initial program 98.4%
Taylor expanded in x around 0 89.9%
associate-*l/93.6%
*-commutative93.6%
Simplified93.6%
Final simplification96.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ t (/ y (- x)))))
(if (<= y -9.5e-44)
t
(if (<= y -5.4e-238)
t_1
(if (<= y 2.25e-307)
(* x (/ z y))
(if (<= y 8.8e-277) t_1 (if (<= y 2.1e-76) (/ (* x z) y) t)))))))
double code(double x, double y, double z, double t) {
double t_1 = t / (y / -x);
double tmp;
if (y <= -9.5e-44) {
tmp = t;
} else if (y <= -5.4e-238) {
tmp = t_1;
} else if (y <= 2.25e-307) {
tmp = x * (z / y);
} else if (y <= 8.8e-277) {
tmp = t_1;
} else if (y <= 2.1e-76) {
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) :: t_1
real(8) :: tmp
t_1 = t / (y / -x)
if (y <= (-9.5d-44)) then
tmp = t
else if (y <= (-5.4d-238)) then
tmp = t_1
else if (y <= 2.25d-307) then
tmp = x * (z / y)
else if (y <= 8.8d-277) then
tmp = t_1
else if (y <= 2.1d-76) 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 t_1 = t / (y / -x);
double tmp;
if (y <= -9.5e-44) {
tmp = t;
} else if (y <= -5.4e-238) {
tmp = t_1;
} else if (y <= 2.25e-307) {
tmp = x * (z / y);
} else if (y <= 8.8e-277) {
tmp = t_1;
} else if (y <= 2.1e-76) {
tmp = (x * z) / y;
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): t_1 = t / (y / -x) tmp = 0 if y <= -9.5e-44: tmp = t elif y <= -5.4e-238: tmp = t_1 elif y <= 2.25e-307: tmp = x * (z / y) elif y <= 8.8e-277: tmp = t_1 elif y <= 2.1e-76: tmp = (x * z) / y else: tmp = t return tmp
function code(x, y, z, t) t_1 = Float64(t / Float64(y / Float64(-x))) tmp = 0.0 if (y <= -9.5e-44) tmp = t; elseif (y <= -5.4e-238) tmp = t_1; elseif (y <= 2.25e-307) tmp = Float64(x * Float64(z / y)); elseif (y <= 8.8e-277) tmp = t_1; elseif (y <= 2.1e-76) tmp = Float64(Float64(x * z) / y); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = t / (y / -x); tmp = 0.0; if (y <= -9.5e-44) tmp = t; elseif (y <= -5.4e-238) tmp = t_1; elseif (y <= 2.25e-307) tmp = x * (z / y); elseif (y <= 8.8e-277) tmp = t_1; elseif (y <= 2.1e-76) tmp = (x * z) / y; else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t / N[(y / (-x)), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -9.5e-44], t, If[LessEqual[y, -5.4e-238], t$95$1, If[LessEqual[y, 2.25e-307], N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 8.8e-277], t$95$1, If[LessEqual[y, 2.1e-76], N[(N[(x * z), $MachinePrecision] / y), $MachinePrecision], t]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t}{\frac{y}{-x}}\\
\mathbf{if}\;y \leq -9.5 \cdot 10^{-44}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq -5.4 \cdot 10^{-238}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 2.25 \cdot 10^{-307}:\\
\;\;\;\;x \cdot \frac{z}{y}\\
\mathbf{elif}\;y \leq 8.8 \cdot 10^{-277}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 2.1 \cdot 10^{-76}:\\
\;\;\;\;\frac{x \cdot z}{y}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -9.49999999999999924e-44 or 2.09999999999999992e-76 < y Initial program 99.2%
Taylor expanded in x around 0 63.8%
if -9.49999999999999924e-44 < y < -5.39999999999999981e-238 or 2.24999999999999994e-307 < y < 8.79999999999999983e-277Initial program 97.3%
Taylor expanded in x around 0 99.9%
Taylor expanded in x around -inf 90.6%
Taylor expanded in z around 0 71.3%
mul-1-neg71.3%
distribute-frac-neg71.3%
distribute-rgt-neg-in71.3%
associate-/l*70.3%
Simplified70.3%
if -5.39999999999999981e-238 < y < 2.24999999999999994e-307Initial program 87.5%
Taylor expanded in x around 0 87.1%
Taylor expanded in x around -inf 86.7%
Taylor expanded in z around inf 68.6%
*-commutative68.6%
associate-*r/81.6%
Simplified81.6%
if 8.79999999999999983e-277 < y < 2.09999999999999992e-76Initial program 97.1%
Taylor expanded in x around 0 99.4%
Taylor expanded in x around -inf 92.5%
Taylor expanded in z around inf 66.0%
Final simplification66.1%
(FPCore (x y z t)
:precision binary64
(if (<= y -1.96e-44)
t
(if (<= y -2.25e-238)
(/ (* x (- t)) y)
(if (<= y 2.2e-307)
(* x (/ z y))
(if (<= y 3.4e-277)
(/ t (/ y (- x)))
(if (<= y 7.6e-78) (/ (* x z) y) t))))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.96e-44) {
tmp = t;
} else if (y <= -2.25e-238) {
tmp = (x * -t) / y;
} else if (y <= 2.2e-307) {
tmp = x * (z / y);
} else if (y <= 3.4e-277) {
tmp = t / (y / -x);
} else if (y <= 7.6e-78) {
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 (y <= (-1.96d-44)) then
tmp = t
else if (y <= (-2.25d-238)) then
tmp = (x * -t) / y
else if (y <= 2.2d-307) then
tmp = x * (z / y)
else if (y <= 3.4d-277) then
tmp = t / (y / -x)
else if (y <= 7.6d-78) 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 (y <= -1.96e-44) {
tmp = t;
} else if (y <= -2.25e-238) {
tmp = (x * -t) / y;
} else if (y <= 2.2e-307) {
tmp = x * (z / y);
} else if (y <= 3.4e-277) {
tmp = t / (y / -x);
} else if (y <= 7.6e-78) {
tmp = (x * z) / y;
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.96e-44: tmp = t elif y <= -2.25e-238: tmp = (x * -t) / y elif y <= 2.2e-307: tmp = x * (z / y) elif y <= 3.4e-277: tmp = t / (y / -x) elif y <= 7.6e-78: tmp = (x * z) / y else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.96e-44) tmp = t; elseif (y <= -2.25e-238) tmp = Float64(Float64(x * Float64(-t)) / y); elseif (y <= 2.2e-307) tmp = Float64(x * Float64(z / y)); elseif (y <= 3.4e-277) tmp = Float64(t / Float64(y / Float64(-x))); elseif (y <= 7.6e-78) tmp = Float64(Float64(x * z) / y); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -1.96e-44) tmp = t; elseif (y <= -2.25e-238) tmp = (x * -t) / y; elseif (y <= 2.2e-307) tmp = x * (z / y); elseif (y <= 3.4e-277) tmp = t / (y / -x); elseif (y <= 7.6e-78) tmp = (x * z) / y; else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.96e-44], t, If[LessEqual[y, -2.25e-238], N[(N[(x * (-t)), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[y, 2.2e-307], N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.4e-277], N[(t / N[(y / (-x)), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 7.6e-78], N[(N[(x * z), $MachinePrecision] / y), $MachinePrecision], t]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.96 \cdot 10^{-44}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq -2.25 \cdot 10^{-238}:\\
\;\;\;\;\frac{x \cdot \left(-t\right)}{y}\\
\mathbf{elif}\;y \leq 2.2 \cdot 10^{-307}:\\
\;\;\;\;x \cdot \frac{z}{y}\\
\mathbf{elif}\;y \leq 3.4 \cdot 10^{-277}:\\
\;\;\;\;\frac{t}{\frac{y}{-x}}\\
\mathbf{elif}\;y \leq 7.6 \cdot 10^{-78}:\\
\;\;\;\;\frac{x \cdot z}{y}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -1.9599999999999999e-44 or 7.5999999999999998e-78 < y Initial program 99.2%
Taylor expanded in x around 0 63.8%
if -1.9599999999999999e-44 < y < -2.24999999999999998e-238Initial program 96.7%
Taylor expanded in x around 0 99.8%
Taylor expanded in x around -inf 90.7%
Taylor expanded in z around 0 70.5%
neg-mul-170.5%
distribute-lft-neg-in70.5%
*-commutative70.5%
Simplified70.5%
if -2.24999999999999998e-238 < y < 2.2e-307Initial program 87.5%
Taylor expanded in x around 0 87.1%
Taylor expanded in x around -inf 86.7%
Taylor expanded in z around inf 68.6%
*-commutative68.6%
associate-*r/81.6%
Simplified81.6%
if 2.2e-307 < y < 3.39999999999999982e-277Initial program 99.8%
Taylor expanded in x around 0 100.0%
Taylor expanded in x around -inf 90.4%
Taylor expanded in z around 0 74.8%
mul-1-neg74.8%
distribute-frac-neg74.8%
distribute-rgt-neg-in74.8%
associate-/l*74.8%
Simplified74.8%
if 3.39999999999999982e-277 < y < 7.5999999999999998e-78Initial program 97.1%
Taylor expanded in x around 0 99.4%
Taylor expanded in x around -inf 92.5%
Taylor expanded in z around inf 66.0%
Final simplification66.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (* x z) y)) (t_2 (* t (- 1.0 (/ x y)))))
(if (<= t -1.75e-116)
t_2
(if (<= t -5e-149)
t_1
(if (<= t -6.5e-179) t (if (<= t 5e-148) t_1 t_2))))))
double code(double x, double y, double z, double t) {
double t_1 = (x * z) / y;
double t_2 = t * (1.0 - (x / y));
double tmp;
if (t <= -1.75e-116) {
tmp = t_2;
} else if (t <= -5e-149) {
tmp = t_1;
} else if (t <= -6.5e-179) {
tmp = t;
} else if (t <= 5e-148) {
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 * z) / y
t_2 = t * (1.0d0 - (x / y))
if (t <= (-1.75d-116)) then
tmp = t_2
else if (t <= (-5d-149)) then
tmp = t_1
else if (t <= (-6.5d-179)) then
tmp = t
else if (t <= 5d-148) 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 * z) / y;
double t_2 = t * (1.0 - (x / y));
double tmp;
if (t <= -1.75e-116) {
tmp = t_2;
} else if (t <= -5e-149) {
tmp = t_1;
} else if (t <= -6.5e-179) {
tmp = t;
} else if (t <= 5e-148) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x * z) / y t_2 = t * (1.0 - (x / y)) tmp = 0 if t <= -1.75e-116: tmp = t_2 elif t <= -5e-149: tmp = t_1 elif t <= -6.5e-179: tmp = t elif t <= 5e-148: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x * z) / y) t_2 = Float64(t * Float64(1.0 - Float64(x / y))) tmp = 0.0 if (t <= -1.75e-116) tmp = t_2; elseif (t <= -5e-149) tmp = t_1; elseif (t <= -6.5e-179) tmp = t; elseif (t <= 5e-148) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x * z) / y; t_2 = t * (1.0 - (x / y)); tmp = 0.0; if (t <= -1.75e-116) tmp = t_2; elseif (t <= -5e-149) tmp = t_1; elseif (t <= -6.5e-179) tmp = t; elseif (t <= 5e-148) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * z), $MachinePrecision] / y), $MachinePrecision]}, Block[{t$95$2 = N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -1.75e-116], t$95$2, If[LessEqual[t, -5e-149], t$95$1, If[LessEqual[t, -6.5e-179], t, If[LessEqual[t, 5e-148], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x \cdot z}{y}\\
t_2 := t \cdot \left(1 - \frac{x}{y}\right)\\
\mathbf{if}\;t \leq -1.75 \cdot 10^{-116}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t \leq -5 \cdot 10^{-149}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq -6.5 \cdot 10^{-179}:\\
\;\;\;\;t\\
\mathbf{elif}\;t \leq 5 \cdot 10^{-148}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if t < -1.74999999999999992e-116 or 4.9999999999999999e-148 < t Initial program 99.9%
Taylor expanded in z around 0 80.3%
mul-1-neg80.3%
unsub-neg80.3%
associate-/l*84.5%
associate-/r/80.5%
Simplified80.5%
Taylor expanded in t around 0 84.5%
if -1.74999999999999992e-116 < t < -4.99999999999999968e-149 or -6.49999999999999996e-179 < t < 4.9999999999999999e-148Initial program 92.8%
Taylor expanded in x around 0 94.1%
Taylor expanded in x around -inf 72.7%
Taylor expanded in z around inf 64.8%
if -4.99999999999999968e-149 < t < -6.49999999999999996e-179Initial program 100.0%
Taylor expanded in x around 0 86.9%
Final simplification79.1%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -500.0) (not (<= (/ x y) 4e-26))) (/ (* x (- z t)) y) (+ t (* (/ x y) z))))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -500.0) || !((x / y) <= 4e-26)) {
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) <= (-500.0d0)) .or. (.not. ((x / y) <= 4d-26))) 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) <= -500.0) || !((x / y) <= 4e-26)) {
tmp = (x * (z - t)) / y;
} else {
tmp = t + ((x / y) * z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -500.0) or not ((x / y) <= 4e-26): 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) <= -500.0) || !(Float64(x / y) <= 4e-26)) 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) <= -500.0) || ~(((x / y) <= 4e-26))) 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], -500.0], N[Not[LessEqual[N[(x / y), $MachinePrecision], 4e-26]], $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 -500 \lor \neg \left(\frac{x}{y} \leq 4 \cdot 10^{-26}\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) < -500 or 4.0000000000000002e-26 < (/.f64 x y) Initial program 96.5%
Taylor expanded in x around 0 93.2%
Taylor expanded in x around -inf 91.1%
if -500 < (/.f64 x y) < 4.0000000000000002e-26Initial program 99.0%
Taylor expanded in z around inf 95.1%
associate-*r/99.0%
Simplified99.0%
Final simplification95.5%
(FPCore (x y z t)
:precision binary64
(if (<= y -1.95e-42)
t
(if (<= y -4.1e-227)
(* (- x) (/ t y))
(if (<= y 1.85e-76) (/ (* x z) y) t))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.95e-42) {
tmp = t;
} else if (y <= -4.1e-227) {
tmp = -x * (t / y);
} else if (y <= 1.85e-76) {
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 (y <= (-1.95d-42)) then
tmp = t
else if (y <= (-4.1d-227)) then
tmp = -x * (t / y)
else if (y <= 1.85d-76) 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 (y <= -1.95e-42) {
tmp = t;
} else if (y <= -4.1e-227) {
tmp = -x * (t / y);
} else if (y <= 1.85e-76) {
tmp = (x * z) / y;
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.95e-42: tmp = t elif y <= -4.1e-227: tmp = -x * (t / y) elif y <= 1.85e-76: tmp = (x * z) / y else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.95e-42) tmp = t; elseif (y <= -4.1e-227) tmp = Float64(Float64(-x) * Float64(t / y)); elseif (y <= 1.85e-76) tmp = Float64(Float64(x * z) / y); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -1.95e-42) tmp = t; elseif (y <= -4.1e-227) tmp = -x * (t / y); elseif (y <= 1.85e-76) tmp = (x * z) / y; else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.95e-42], t, If[LessEqual[y, -4.1e-227], N[((-x) * N[(t / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.85e-76], N[(N[(x * z), $MachinePrecision] / y), $MachinePrecision], t]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.95 \cdot 10^{-42}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq -4.1 \cdot 10^{-227}:\\
\;\;\;\;\left(-x\right) \cdot \frac{t}{y}\\
\mathbf{elif}\;y \leq 1.85 \cdot 10^{-76}:\\
\;\;\;\;\frac{x \cdot z}{y}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -1.9500000000000001e-42 or 1.85000000000000006e-76 < y Initial program 99.2%
Taylor expanded in x around 0 63.8%
if -1.9500000000000001e-42 < y < -4.10000000000000009e-227Initial program 96.0%
Taylor expanded in x around 0 99.9%
Taylor expanded in x around -inf 88.9%
Taylor expanded in z around 0 72.7%
associate-/l*71.1%
neg-mul-171.1%
distribute-neg-frac71.1%
associate-/r/70.3%
*-commutative70.3%
distribute-frac-neg70.3%
Simplified70.3%
if -4.10000000000000009e-227 < y < 1.85000000000000006e-76Initial program 95.4%
Taylor expanded in x around 0 96.6%
Taylor expanded in x around -inf 91.4%
Taylor expanded in z around inf 59.5%
Final simplification63.4%
(FPCore (x y z t) :precision binary64 (if (or (<= t -5.5e-45) (not (<= t 2.45e-45))) (* t (- 1.0 (/ x y))) (+ t (* (/ x y) z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -5.5e-45) || !(t <= 2.45e-45)) {
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 ((t <= (-5.5d-45)) .or. (.not. (t <= 2.45d-45))) 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 ((t <= -5.5e-45) || !(t <= 2.45e-45)) {
tmp = t * (1.0 - (x / y));
} else {
tmp = t + ((x / y) * z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -5.5e-45) or not (t <= 2.45e-45): tmp = t * (1.0 - (x / y)) else: tmp = t + ((x / y) * z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -5.5e-45) || !(t <= 2.45e-45)) 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 ((t <= -5.5e-45) || ~((t <= 2.45e-45))) tmp = t * (1.0 - (x / y)); else tmp = t + ((x / y) * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -5.5e-45], N[Not[LessEqual[t, 2.45e-45]], $MachinePrecision]], 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}\;t \leq -5.5 \cdot 10^{-45} \lor \neg \left(t \leq 2.45 \cdot 10^{-45}\right):\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;t + \frac{x}{y} \cdot z\\
\end{array}
\end{array}
if t < -5.5000000000000003e-45 or 2.4499999999999999e-45 < t Initial program 99.9%
Taylor expanded in z around 0 87.4%
mul-1-neg87.4%
unsub-neg87.4%
associate-/l*92.5%
associate-/r/87.5%
Simplified87.5%
Taylor expanded in t around 0 92.6%
if -5.5000000000000003e-45 < t < 2.4499999999999999e-45Initial program 95.4%
Taylor expanded in z around inf 85.3%
associate-*r/86.9%
Simplified86.9%
Final simplification90.1%
(FPCore (x y z t) :precision binary64 (if (<= y -5.5e-20) t (if (<= y 5.6e-78) (* x (/ z y)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -5.5e-20) {
tmp = t;
} else if (y <= 5.6e-78) {
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 (y <= (-5.5d-20)) then
tmp = t
else if (y <= 5.6d-78) 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 (y <= -5.5e-20) {
tmp = t;
} else if (y <= 5.6e-78) {
tmp = x * (z / y);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -5.5e-20: tmp = t elif y <= 5.6e-78: tmp = x * (z / y) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -5.5e-20) tmp = t; elseif (y <= 5.6e-78) 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 (y <= -5.5e-20) tmp = t; elseif (y <= 5.6e-78) tmp = x * (z / y); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -5.5e-20], t, If[LessEqual[y, 5.6e-78], N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.5 \cdot 10^{-20}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 5.6 \cdot 10^{-78}:\\
\;\;\;\;x \cdot \frac{z}{y}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -5.4999999999999996e-20 or 5.60000000000000047e-78 < y Initial program 99.1%
Taylor expanded in x around 0 64.7%
if -5.4999999999999996e-20 < y < 5.60000000000000047e-78Initial program 95.7%
Taylor expanded in x around 0 97.6%
Taylor expanded in x around -inf 90.0%
Taylor expanded in z around inf 50.8%
*-commutative50.8%
associate-*r/47.9%
Simplified47.9%
Final simplification58.7%
(FPCore (x y z t) :precision binary64 (if (<= y -3.6e-25) t (if (<= y 6.4e-77) (/ (* x z) y) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -3.6e-25) {
tmp = t;
} else if (y <= 6.4e-77) {
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 (y <= (-3.6d-25)) then
tmp = t
else if (y <= 6.4d-77) 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 (y <= -3.6e-25) {
tmp = t;
} else if (y <= 6.4e-77) {
tmp = (x * z) / y;
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -3.6e-25: tmp = t elif y <= 6.4e-77: tmp = (x * z) / y else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -3.6e-25) tmp = t; elseif (y <= 6.4e-77) tmp = Float64(Float64(x * z) / y); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -3.6e-25) tmp = t; elseif (y <= 6.4e-77) tmp = (x * z) / y; else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -3.6e-25], t, If[LessEqual[y, 6.4e-77], N[(N[(x * z), $MachinePrecision] / y), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.6 \cdot 10^{-25}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 6.4 \cdot 10^{-77}:\\
\;\;\;\;\frac{x \cdot z}{y}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -3.5999999999999999e-25 or 6.39999999999999999e-77 < y Initial program 99.1%
Taylor expanded in x around 0 64.7%
if -3.5999999999999999e-25 < y < 6.39999999999999999e-77Initial program 95.7%
Taylor expanded in x around 0 97.6%
Taylor expanded in x around -inf 90.0%
Taylor expanded in z around inf 50.8%
Final simplification59.7%
(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.9%
Final simplification97.9%
(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.9%
Taylor expanded in x around 0 44.4%
Final simplification44.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 2023174
(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))