
(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 (if (<= (+ t (* (/ x y) (- z t))) (- INFINITY)) (fma x (/ (- z t) y) t) (fma (/ x y) (- z t) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t + ((x / y) * (z - t))) <= -((double) INFINITY)) {
tmp = fma(x, ((z - t) / y), t);
} else {
tmp = fma((x / y), (z - t), t);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(t + Float64(Float64(x / y) * Float64(z - t))) <= Float64(-Inf)) tmp = fma(x, Float64(Float64(z - t) / y), t); else tmp = fma(Float64(x / y), Float64(z - t), t); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(t + N[(N[(x / y), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], (-Infinity)], N[(x * N[(N[(z - t), $MachinePrecision] / y), $MachinePrecision] + t), $MachinePrecision], N[(N[(x / y), $MachinePrecision] * N[(z - t), $MachinePrecision] + t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t + \frac{x}{y} \cdot \left(z - t\right) \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(x, \frac{z - t}{y}, t\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{y}, z - t, t\right)\\
\end{array}
\end{array}
if (+.f64 (*.f64 (/.f64 x y) (-.f64 z t)) t) < -inf.0Initial program 86.6%
associate-*l/99.9%
associate-/l*100.0%
fma-define100.0%
Simplified100.0%
if -inf.0 < (+.f64 (*.f64 (/.f64 x y) (-.f64 z t)) t) Initial program 99.0%
fma-define99.0%
Simplified99.0%
Final simplification99.1%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (+ t (* (/ x y) (- z t))))) (if (<= t_1 (- INFINITY)) (fma x (/ (- z t) y) t) t_1)))
double code(double x, double y, double z, double t) {
double t_1 = t + ((x / y) * (z - t));
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = fma(x, ((z - t) / y), t);
} else {
tmp = t_1;
}
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 <= Float64(-Inf)) tmp = fma(x, Float64(Float64(z - t) / y), t); else tmp = t_1; end return 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, (-Infinity)], N[(x * N[(N[(z - t), $MachinePrecision] / y), $MachinePrecision] + t), $MachinePrecision], t$95$1]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t + \frac{x}{y} \cdot \left(z - t\right)\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(x, \frac{z - t}{y}, t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 (*.f64 (/.f64 x y) (-.f64 z t)) t) < -inf.0Initial program 86.6%
associate-*l/99.9%
associate-/l*100.0%
fma-define100.0%
Simplified100.0%
if -inf.0 < (+.f64 (*.f64 (/.f64 x y) (-.f64 z t)) t) Initial program 99.0%
Final simplification99.1%
(FPCore (x y z t) :precision binary64 (if (<= (/ x y) -5e+227) (* t (/ (- x) y)) (if (or (<= (/ x y) -1e-40) (not (<= (/ x y) 5e-18))) (* (/ x y) z) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -5e+227) {
tmp = t * (-x / y);
} else if (((x / y) <= -1e-40) || !((x / y) <= 5e-18)) {
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+227)) then
tmp = t * (-x / y)
else if (((x / y) <= (-1d-40)) .or. (.not. ((x / y) <= 5d-18))) 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+227) {
tmp = t * (-x / y);
} else if (((x / y) <= -1e-40) || !((x / y) <= 5e-18)) {
tmp = (x / y) * z;
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -5e+227: tmp = t * (-x / y) elif ((x / y) <= -1e-40) or not ((x / y) <= 5e-18): tmp = (x / y) * z else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -5e+227) tmp = Float64(t * Float64(Float64(-x) / y)); elseif ((Float64(x / y) <= -1e-40) || !(Float64(x / y) <= 5e-18)) 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+227) tmp = t * (-x / y); elseif (((x / y) <= -1e-40) || ~(((x / y) <= 5e-18))) tmp = (x / y) * z; else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -5e+227], N[(t * N[((-x) / y), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[N[(x / y), $MachinePrecision], -1e-40], N[Not[LessEqual[N[(x / y), $MachinePrecision], 5e-18]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -5 \cdot 10^{+227}:\\
\;\;\;\;t \cdot \frac{-x}{y}\\
\mathbf{elif}\;\frac{x}{y} \leq -1 \cdot 10^{-40} \lor \neg \left(\frac{x}{y} \leq 5 \cdot 10^{-18}\right):\\
\;\;\;\;\frac{x}{y} \cdot z\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if (/.f64 x y) < -4.9999999999999996e227Initial program 87.9%
Taylor expanded in z around 0 68.6%
mul-1-neg68.6%
*-commutative68.6%
associate-*l/68.8%
*-lft-identity68.8%
distribute-lft-neg-in68.8%
mul-1-neg68.8%
distribute-rgt-in68.8%
mul-1-neg68.8%
unsub-neg68.8%
Simplified68.8%
Taylor expanded in x around inf 68.8%
associate-*r/68.8%
neg-mul-168.8%
Simplified68.8%
if -4.9999999999999996e227 < (/.f64 x y) < -9.9999999999999993e-41 or 5.00000000000000036e-18 < (/.f64 x y) Initial program 98.1%
clear-num98.1%
associate-/r/98.1%
Applied egg-rr98.1%
Taylor expanded in y around 0 90.3%
Taylor expanded in x around -inf 84.0%
Taylor expanded in z around inf 50.5%
associate-*l/59.2%
*-commutative59.2%
Simplified59.2%
if -9.9999999999999993e-41 < (/.f64 x y) < 5.00000000000000036e-18Initial program 99.0%
Taylor expanded in x around 0 81.1%
Final simplification69.7%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (+ t (* (/ x y) (- z t))))) (if (<= t_1 (- INFINITY)) (/ (* x (- z t)) y) t_1)))
double code(double x, double y, double z, double t) {
double t_1 = t + ((x / y) * (z - t));
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = (x * (z - t)) / y;
} else {
tmp = t_1;
}
return tmp;
}
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 <= -Double.POSITIVE_INFINITY) {
tmp = (x * (z - t)) / y;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = t + ((x / y) * (z - t)) tmp = 0 if t_1 <= -math.inf: tmp = (x * (z - t)) / y else: tmp = t_1 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 <= Float64(-Inf)) tmp = Float64(Float64(x * Float64(z - t)) / y); else tmp = t_1; 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 <= -Inf) tmp = (x * (z - t)) / y; else tmp = t_1; 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, (-Infinity)], N[(N[(x * N[(z - t), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], t$95$1]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t + \frac{x}{y} \cdot \left(z - t\right)\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\frac{x \cdot \left(z - t\right)}{y}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 (*.f64 (/.f64 x y) (-.f64 z t)) t) < -inf.0Initial program 86.6%
clear-num86.6%
associate-/r/86.6%
Applied egg-rr86.6%
Taylor expanded in y around 0 99.9%
Taylor expanded in x around -inf 99.9%
if -inf.0 < (+.f64 (*.f64 (/.f64 x y) (-.f64 z t)) t) Initial program 99.0%
Final simplification99.1%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -1e+57) (not (<= (/ x y) 5e-5))) (/ (* x (- z t)) y) (+ t (* (/ x y) z))))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -1e+57) || !((x / y) <= 5e-5)) {
tmp = (x * (z - t)) / y;
} else {
tmp = t + ((x / y) * z);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (((x / y) <= (-1d+57)) .or. (.not. ((x / y) <= 5d-5))) then
tmp = (x * (z - t)) / y
else
tmp = t + ((x / y) * z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -1e+57) || !((x / y) <= 5e-5)) {
tmp = (x * (z - t)) / y;
} else {
tmp = t + ((x / y) * z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -1e+57) or not ((x / y) <= 5e-5): tmp = (x * (z - t)) / y else: tmp = t + ((x / y) * z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -1e+57) || !(Float64(x / y) <= 5e-5)) 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) <= -1e+57) || ~(((x / y) <= 5e-5))) tmp = (x * (z - t)) / y; else tmp = t + ((x / y) * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -1e+57], N[Not[LessEqual[N[(x / y), $MachinePrecision], 5e-5]], $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 -1 \cdot 10^{+57} \lor \neg \left(\frac{x}{y} \leq 5 \cdot 10^{-5}\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) < -1.00000000000000005e57 or 5.00000000000000024e-5 < (/.f64 x y) Initial program 95.3%
clear-num95.3%
associate-/r/95.3%
Applied egg-rr95.3%
Taylor expanded in y around 0 94.8%
Taylor expanded in x around -inf 93.9%
if -1.00000000000000005e57 < (/.f64 x y) < 5.00000000000000024e-5Initial program 99.1%
Taylor expanded in z around inf 97.0%
Final simplification95.5%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -1e-40) (not (<= (/ x y) 5e-18))) (* (/ x y) z) t))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -1e-40) || !((x / y) <= 5e-18)) {
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) <= (-1d-40)) .or. (.not. ((x / y) <= 5d-18))) 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) <= -1e-40) || !((x / y) <= 5e-18)) {
tmp = (x / y) * z;
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -1e-40) or not ((x / y) <= 5e-18): tmp = (x / y) * z else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -1e-40) || !(Float64(x / y) <= 5e-18)) 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) <= -1e-40) || ~(((x / y) <= 5e-18))) tmp = (x / y) * z; else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -1e-40], N[Not[LessEqual[N[(x / y), $MachinePrecision], 5e-18]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision], t]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -1 \cdot 10^{-40} \lor \neg \left(\frac{x}{y} \leq 5 \cdot 10^{-18}\right):\\
\;\;\;\;\frac{x}{y} \cdot z\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if (/.f64 x y) < -9.9999999999999993e-41 or 5.00000000000000036e-18 < (/.f64 x y) Initial program 96.0%
clear-num95.9%
associate-/r/95.9%
Applied egg-rr95.9%
Taylor expanded in y around 0 92.3%
Taylor expanded in x around -inf 87.4%
Taylor expanded in z around inf 49.5%
associate-*l/56.5%
*-commutative56.5%
Simplified56.5%
if -9.9999999999999993e-41 < (/.f64 x y) < 5.00000000000000036e-18Initial program 99.0%
Taylor expanded in x around 0 81.1%
Final simplification67.0%
(FPCore (x y z t) :precision binary64 (if (or (<= t -2.55e-30) (not (<= t 4.4e+95))) (* t (- 1.0 (/ x y))) (+ t (* (/ x y) z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.55e-30) || !(t <= 4.4e+95)) {
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 <= (-2.55d-30)) .or. (.not. (t <= 4.4d+95))) 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 <= -2.55e-30) || !(t <= 4.4e+95)) {
tmp = t * (1.0 - (x / y));
} else {
tmp = t + ((x / y) * z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -2.55e-30) or not (t <= 4.4e+95): 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 <= -2.55e-30) || !(t <= 4.4e+95)) 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 <= -2.55e-30) || ~((t <= 4.4e+95))) 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, -2.55e-30], N[Not[LessEqual[t, 4.4e+95]], $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 -2.55 \cdot 10^{-30} \lor \neg \left(t \leq 4.4 \cdot 10^{+95}\right):\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;t + \frac{x}{y} \cdot z\\
\end{array}
\end{array}
if t < -2.54999999999999986e-30 or 4.3999999999999998e95 < t Initial program 99.9%
Taylor expanded in z around 0 84.7%
mul-1-neg84.7%
*-commutative84.7%
associate-*l/87.9%
*-lft-identity87.9%
distribute-lft-neg-in87.9%
mul-1-neg87.9%
distribute-rgt-in87.9%
mul-1-neg87.9%
unsub-neg87.9%
Simplified87.9%
if -2.54999999999999986e-30 < t < 4.3999999999999998e95Initial program 95.0%
Taylor expanded in z around inf 86.2%
Final simplification87.0%
(FPCore (x y z t) :precision binary64 (if (or (<= t -8.2e-41) (not (<= t 9.6e-8))) (* t (- 1.0 (/ x y))) (+ t (* x (/ z y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -8.2e-41) || !(t <= 9.6e-8)) {
tmp = t * (1.0 - (x / y));
} 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 ((t <= (-8.2d-41)) .or. (.not. (t <= 9.6d-8))) then
tmp = t * (1.0d0 - (x / y))
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 ((t <= -8.2e-41) || !(t <= 9.6e-8)) {
tmp = t * (1.0 - (x / y));
} else {
tmp = t + (x * (z / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -8.2e-41) or not (t <= 9.6e-8): tmp = t * (1.0 - (x / y)) else: tmp = t + (x * (z / y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -8.2e-41) || !(t <= 9.6e-8)) tmp = Float64(t * Float64(1.0 - Float64(x / y))); 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 ((t <= -8.2e-41) || ~((t <= 9.6e-8))) tmp = t * (1.0 - (x / y)); else tmp = t + (x * (z / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -8.2e-41], N[Not[LessEqual[t, 9.6e-8]], $MachinePrecision]], N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t + N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -8.2 \cdot 10^{-41} \lor \neg \left(t \leq 9.6 \cdot 10^{-8}\right):\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;t + x \cdot \frac{z}{y}\\
\end{array}
\end{array}
if t < -8.20000000000000028e-41 or 9.59999999999999994e-8 < t Initial program 99.9%
Taylor expanded in z around 0 84.2%
mul-1-neg84.2%
*-commutative84.2%
associate-*l/87.0%
*-lft-identity87.0%
distribute-lft-neg-in87.0%
mul-1-neg87.0%
distribute-rgt-in87.0%
mul-1-neg87.0%
unsub-neg87.0%
Simplified87.0%
if -8.20000000000000028e-41 < t < 9.59999999999999994e-8Initial program 94.4%
Taylor expanded in z around inf 86.2%
associate-/l*84.3%
Simplified84.3%
Final simplification85.7%
(FPCore (x y z t) :precision binary64 (if (or (<= t -8.5e-45) (not (<= t 2.65e-141))) (* t (- 1.0 (/ x y))) (* (/ x y) z)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -8.5e-45) || !(t <= 2.65e-141)) {
tmp = t * (1.0 - (x / y));
} else {
tmp = (x / y) * z;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((t <= (-8.5d-45)) .or. (.not. (t <= 2.65d-141))) then
tmp = t * (1.0d0 - (x / y))
else
tmp = (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 <= -8.5e-45) || !(t <= 2.65e-141)) {
tmp = t * (1.0 - (x / y));
} else {
tmp = (x / y) * z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -8.5e-45) or not (t <= 2.65e-141): tmp = t * (1.0 - (x / y)) else: tmp = (x / y) * z return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -8.5e-45) || !(t <= 2.65e-141)) tmp = Float64(t * Float64(1.0 - Float64(x / y))); else tmp = Float64(Float64(x / y) * z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -8.5e-45) || ~((t <= 2.65e-141))) tmp = t * (1.0 - (x / y)); else tmp = (x / y) * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -8.5e-45], N[Not[LessEqual[t, 2.65e-141]], $MachinePrecision]], N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -8.5 \cdot 10^{-45} \lor \neg \left(t \leq 2.65 \cdot 10^{-141}\right):\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} \cdot z\\
\end{array}
\end{array}
if t < -8.50000000000000041e-45 or 2.65000000000000004e-141 < t Initial program 99.9%
Taylor expanded in z around 0 81.6%
mul-1-neg81.6%
*-commutative81.6%
associate-*l/84.5%
*-lft-identity84.5%
distribute-lft-neg-in84.5%
mul-1-neg84.5%
distribute-rgt-in84.5%
mul-1-neg84.5%
unsub-neg84.5%
Simplified84.5%
if -8.50000000000000041e-45 < t < 2.65000000000000004e-141Initial program 92.8%
clear-num92.8%
associate-/r/92.8%
Applied egg-rr92.8%
Taylor expanded in y around 0 94.9%
Taylor expanded in x around -inf 76.0%
Taylor expanded in z around inf 69.2%
associate-*l/70.1%
*-commutative70.1%
Simplified70.1%
Final simplification79.2%
(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.3%
Taylor expanded in x around 0 37.8%
(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 2024180
(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))