
(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 (+ t (/ (- z t) (/ y x))))
double code(double x, double y, double z, double t) {
return t + ((z - t) / (y / x));
}
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 + ((z - t) / (y / x))
end function
public static double code(double x, double y, double z, double t) {
return t + ((z - t) / (y / x));
}
def code(x, y, z, t): return t + ((z - t) / (y / x))
function code(x, y, z, t) return Float64(t + Float64(Float64(z - t) / Float64(y / x))) end
function tmp = code(x, y, z, t) tmp = t + ((z - t) / (y / x)); end
code[x_, y_, z_, t_] := N[(t + N[(N[(z - t), $MachinePrecision] / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
t + \frac{z - t}{\frac{y}{x}}
\end{array}
Initial program 97.9%
Taylor expanded in x around 0 93.1%
associate-*r/93.2%
*-commutative93.2%
associate-/r/98.5%
Simplified98.5%
Final simplification98.5%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.2e+62) (not (<= t 7.2e+50))) (- t (/ t (/ y x))) (+ t (/ z (/ y x)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.2e+62) || !(t <= 7.2e+50)) {
tmp = t - (t / (y / x));
} else {
tmp = t + (z / (y / x));
}
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.2d+62)) .or. (.not. (t <= 7.2d+50))) then
tmp = t - (t / (y / x))
else
tmp = t + (z / (y / x))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.2e+62) || !(t <= 7.2e+50)) {
tmp = t - (t / (y / x));
} else {
tmp = t + (z / (y / x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1.2e+62) or not (t <= 7.2e+50): tmp = t - (t / (y / x)) else: tmp = t + (z / (y / x)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1.2e+62) || !(t <= 7.2e+50)) tmp = Float64(t - Float64(t / Float64(y / x))); else tmp = Float64(t + Float64(z / Float64(y / x))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -1.2e+62) || ~((t <= 7.2e+50))) tmp = t - (t / (y / x)); else tmp = t + (z / (y / x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.2e+62], N[Not[LessEqual[t, 7.2e+50]], $MachinePrecision]], N[(t - N[(t / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t + N[(z / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.2 \cdot 10^{+62} \lor \neg \left(t \leq 7.2 \cdot 10^{+50}\right):\\
\;\;\;\;t - \frac{t}{\frac{y}{x}}\\
\mathbf{else}:\\
\;\;\;\;t + \frac{z}{\frac{y}{x}}\\
\end{array}
\end{array}
if t < -1.2e62 or 7.19999999999999972e50 < t Initial program 99.9%
Taylor expanded in x around 0 90.2%
associate-*r/91.4%
*-commutative91.4%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in z around 0 85.8%
mul-1-neg85.8%
associate-*r/94.6%
sub-neg94.6%
Simplified94.6%
clear-num94.6%
div-inv94.6%
Applied egg-rr94.6%
if -1.2e62 < t < 7.19999999999999972e50Initial program 96.4%
Taylor expanded in z around inf 82.9%
associate-/l*83.5%
Simplified83.5%
*-commutative83.5%
associate-/r/85.7%
Applied egg-rr85.7%
Final simplification89.5%
(FPCore (x y z t) :precision binary64 (if (or (<= t -5.4e+62) (not (<= t 6.8e+50))) (* t (- 1.0 (/ x y))) (+ t (/ z (/ y x)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -5.4e+62) || !(t <= 6.8e+50)) {
tmp = t * (1.0 - (x / y));
} else {
tmp = t + (z / (y / x));
}
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.4d+62)) .or. (.not. (t <= 6.8d+50))) then
tmp = t * (1.0d0 - (x / y))
else
tmp = t + (z / (y / x))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -5.4e+62) || !(t <= 6.8e+50)) {
tmp = t * (1.0 - (x / y));
} else {
tmp = t + (z / (y / x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -5.4e+62) or not (t <= 6.8e+50): tmp = t * (1.0 - (x / y)) else: tmp = t + (z / (y / x)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -5.4e+62) || !(t <= 6.8e+50)) tmp = Float64(t * Float64(1.0 - Float64(x / y))); else tmp = Float64(t + Float64(z / Float64(y / x))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -5.4e+62) || ~((t <= 6.8e+50))) tmp = t * (1.0 - (x / y)); else tmp = t + (z / (y / x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -5.4e+62], N[Not[LessEqual[t, 6.8e+50]], $MachinePrecision]], N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t + N[(z / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5.4 \cdot 10^{+62} \lor \neg \left(t \leq 6.8 \cdot 10^{+50}\right):\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;t + \frac{z}{\frac{y}{x}}\\
\end{array}
\end{array}
if t < -5.4e62 or 6.7999999999999997e50 < t Initial program 99.9%
Taylor expanded in z around 0 85.8%
mul-1-neg85.8%
*-rgt-identity85.8%
associate-/l*94.6%
distribute-rgt-neg-in94.6%
mul-1-neg94.6%
distribute-lft-in94.6%
mul-1-neg94.6%
unsub-neg94.6%
Simplified94.6%
if -5.4e62 < t < 6.7999999999999997e50Initial program 96.4%
Taylor expanded in z around inf 82.9%
associate-/l*83.5%
Simplified83.5%
*-commutative83.5%
associate-/r/85.7%
Applied egg-rr85.7%
Final simplification89.5%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.8e+62) (not (<= t 5.4e+51))) (* t (- 1.0 (/ x y))) (+ t (* z (/ x y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.8e+62) || !(t <= 5.4e+51)) {
tmp = t * (1.0 - (x / y));
} else {
tmp = t + (z * (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 ((t <= (-1.8d+62)) .or. (.not. (t <= 5.4d+51))) then
tmp = t * (1.0d0 - (x / y))
else
tmp = t + (z * (x / y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.8e+62) || !(t <= 5.4e+51)) {
tmp = t * (1.0 - (x / y));
} else {
tmp = t + (z * (x / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1.8e+62) or not (t <= 5.4e+51): tmp = t * (1.0 - (x / y)) else: tmp = t + (z * (x / y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1.8e+62) || !(t <= 5.4e+51)) tmp = Float64(t * Float64(1.0 - Float64(x / y))); else tmp = Float64(t + Float64(z * Float64(x / y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -1.8e+62) || ~((t <= 5.4e+51))) tmp = t * (1.0 - (x / y)); else tmp = t + (z * (x / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.8e+62], N[Not[LessEqual[t, 5.4e+51]], $MachinePrecision]], N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t + N[(z * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.8 \cdot 10^{+62} \lor \neg \left(t \leq 5.4 \cdot 10^{+51}\right):\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;t + z \cdot \frac{x}{y}\\
\end{array}
\end{array}
if t < -1.8e62 or 5.39999999999999983e51 < t Initial program 99.9%
Taylor expanded in z around 0 85.8%
mul-1-neg85.8%
*-rgt-identity85.8%
associate-/l*94.6%
distribute-rgt-neg-in94.6%
mul-1-neg94.6%
distribute-lft-in94.6%
mul-1-neg94.6%
unsub-neg94.6%
Simplified94.6%
if -1.8e62 < t < 5.39999999999999983e51Initial program 96.4%
Taylor expanded in z around inf 84.7%
Final simplification88.9%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.1e+62) (not (<= t 5.8e+50))) (* t (- 1.0 (/ x y))) (+ t (* x (/ z y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.1e+62) || !(t <= 5.8e+50)) {
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 <= (-1.1d+62)) .or. (.not. (t <= 5.8d+50))) 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 <= -1.1e+62) || !(t <= 5.8e+50)) {
tmp = t * (1.0 - (x / y));
} else {
tmp = t + (x * (z / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1.1e+62) or not (t <= 5.8e+50): 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 <= -1.1e+62) || !(t <= 5.8e+50)) 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 <= -1.1e+62) || ~((t <= 5.8e+50))) 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, -1.1e+62], N[Not[LessEqual[t, 5.8e+50]], $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 -1.1 \cdot 10^{+62} \lor \neg \left(t \leq 5.8 \cdot 10^{+50}\right):\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;t + x \cdot \frac{z}{y}\\
\end{array}
\end{array}
if t < -1.10000000000000007e62 or 5.8e50 < t Initial program 99.9%
Taylor expanded in z around 0 85.8%
mul-1-neg85.8%
*-rgt-identity85.8%
associate-/l*94.6%
distribute-rgt-neg-in94.6%
mul-1-neg94.6%
distribute-lft-in94.6%
mul-1-neg94.6%
unsub-neg94.6%
Simplified94.6%
if -1.10000000000000007e62 < t < 5.8e50Initial program 96.4%
Taylor expanded in z around inf 82.9%
associate-/l*83.5%
Simplified83.5%
Final simplification88.2%
(FPCore (x y z t) :precision binary64 (if (<= t -8.6e+62) (- t (* t (/ x y))) (if (<= t 1.45e+52) (+ t (/ z (/ y x))) (* t (- 1.0 (/ x y))))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -8.6e+62) {
tmp = t - (t * (x / y));
} else if (t <= 1.45e+52) {
tmp = t + (z / (y / x));
} 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 (t <= (-8.6d+62)) then
tmp = t - (t * (x / y))
else if (t <= 1.45d+52) then
tmp = t + (z / (y / x))
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 (t <= -8.6e+62) {
tmp = t - (t * (x / y));
} else if (t <= 1.45e+52) {
tmp = t + (z / (y / x));
} else {
tmp = t * (1.0 - (x / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -8.6e+62: tmp = t - (t * (x / y)) elif t <= 1.45e+52: tmp = t + (z / (y / x)) else: tmp = t * (1.0 - (x / y)) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -8.6e+62) tmp = Float64(t - Float64(t * Float64(x / y))); elseif (t <= 1.45e+52) tmp = Float64(t + Float64(z / Float64(y / x))); 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 (t <= -8.6e+62) tmp = t - (t * (x / y)); elseif (t <= 1.45e+52) tmp = t + (z / (y / x)); else tmp = t * (1.0 - (x / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -8.6e+62], N[(t - N[(t * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.45e+52], N[(t + N[(z / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -8.6 \cdot 10^{+62}:\\
\;\;\;\;t - t \cdot \frac{x}{y}\\
\mathbf{elif}\;t \leq 1.45 \cdot 10^{+52}:\\
\;\;\;\;t + \frac{z}{\frac{y}{x}}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\
\end{array}
\end{array}
if t < -8.5999999999999994e62Initial program 99.9%
Taylor expanded in x around 0 90.9%
associate-*r/91.3%
*-commutative91.3%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in z around 0 92.7%
mul-1-neg92.7%
associate-*r/99.9%
sub-neg99.9%
Simplified99.9%
if -8.5999999999999994e62 < t < 1.45e52Initial program 96.4%
Taylor expanded in z around inf 82.9%
associate-/l*83.5%
Simplified83.5%
*-commutative83.5%
associate-/r/85.7%
Applied egg-rr85.7%
if 1.45e52 < t Initial program 99.9%
Taylor expanded in z around 0 79.1%
mul-1-neg79.1%
*-rgt-identity79.1%
associate-/l*89.4%
distribute-rgt-neg-in89.4%
mul-1-neg89.4%
distribute-lft-in89.4%
mul-1-neg89.4%
unsub-neg89.4%
Simplified89.4%
Final simplification89.5%
(FPCore (x y z t) :precision binary64 (if (<= y -5.4e+15) t (if (<= y 9e+41) (/ (- t) (/ y x)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -5.4e+15) {
tmp = t;
} else if (y <= 9e+41) {
tmp = -t / (y / x);
} 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.4d+15)) then
tmp = t
else if (y <= 9d+41) then
tmp = -t / (y / x)
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.4e+15) {
tmp = t;
} else if (y <= 9e+41) {
tmp = -t / (y / x);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -5.4e+15: tmp = t elif y <= 9e+41: tmp = -t / (y / x) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -5.4e+15) tmp = t; elseif (y <= 9e+41) tmp = Float64(Float64(-t) / Float64(y / x)); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -5.4e+15) tmp = t; elseif (y <= 9e+41) tmp = -t / (y / x); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -5.4e+15], t, If[LessEqual[y, 9e+41], N[((-t) / N[(y / x), $MachinePrecision]), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.4 \cdot 10^{+15}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 9 \cdot 10^{+41}:\\
\;\;\;\;\frac{-t}{\frac{y}{x}}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -5.4e15 or 9.0000000000000002e41 < y Initial program 99.6%
Taylor expanded in x around 0 64.8%
if -5.4e15 < y < 9.0000000000000002e41Initial program 96.4%
Taylor expanded in x around 0 97.7%
associate-*r/89.5%
*-commutative89.5%
associate-/r/97.5%
Simplified97.5%
Taylor expanded in z around 0 59.5%
mul-1-neg59.5%
associate-*r/59.5%
sub-neg59.5%
Simplified59.5%
Taylor expanded in x around inf 48.8%
associate-*l/46.1%
associate-*r*46.1%
neg-mul-146.1%
*-commutative46.1%
distribute-neg-frac246.1%
Simplified46.1%
*-commutative46.1%
distribute-frac-neg246.1%
distribute-lft-neg-in46.1%
associate-/r/48.8%
distribute-neg-frac48.8%
Applied egg-rr48.8%
(FPCore (x y z t) :precision binary64 (if (<= y -3.7e+15) t (if (<= y 1.85e+40) (/ x (/ y (- t))) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -3.7e+15) {
tmp = t;
} else if (y <= 1.85e+40) {
tmp = x / (y / -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 (y <= (-3.7d+15)) then
tmp = t
else if (y <= 1.85d+40) then
tmp = x / (y / -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 (y <= -3.7e+15) {
tmp = t;
} else if (y <= 1.85e+40) {
tmp = x / (y / -t);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -3.7e+15: tmp = t elif y <= 1.85e+40: tmp = x / (y / -t) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -3.7e+15) tmp = t; elseif (y <= 1.85e+40) tmp = Float64(x / Float64(y / Float64(-t))); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -3.7e+15) tmp = t; elseif (y <= 1.85e+40) tmp = x / (y / -t); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -3.7e+15], t, If[LessEqual[y, 1.85e+40], N[(x / N[(y / (-t)), $MachinePrecision]), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.7 \cdot 10^{+15}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 1.85 \cdot 10^{+40}:\\
\;\;\;\;\frac{x}{\frac{y}{-t}}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -3.7e15 or 1.85e40 < y Initial program 99.6%
Taylor expanded in x around 0 64.8%
if -3.7e15 < y < 1.85e40Initial program 96.4%
Taylor expanded in x around 0 97.7%
associate-*r/89.5%
*-commutative89.5%
associate-/r/97.5%
Simplified97.5%
Taylor expanded in z around 0 59.5%
mul-1-neg59.5%
associate-*r/59.5%
sub-neg59.5%
Simplified59.5%
Taylor expanded in x around inf 48.8%
mul-1-neg48.8%
associate-*r/48.8%
*-commutative48.8%
associate-/r/46.3%
distribute-neg-frac246.3%
Simplified46.3%
Final simplification54.9%
(FPCore (x y z t) :precision binary64 (if (<= y -1.52e+16) t (if (<= y 2.3e+44) (* x (/ t (- y))) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.52e+16) {
tmp = t;
} else if (y <= 2.3e+44) {
tmp = x * (t / -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.52d+16)) then
tmp = t
else if (y <= 2.3d+44) then
tmp = x * (t / -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.52e+16) {
tmp = t;
} else if (y <= 2.3e+44) {
tmp = x * (t / -y);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.52e+16: tmp = t elif y <= 2.3e+44: tmp = x * (t / -y) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.52e+16) tmp = t; elseif (y <= 2.3e+44) tmp = Float64(x * Float64(t / Float64(-y))); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -1.52e+16) tmp = t; elseif (y <= 2.3e+44) tmp = x * (t / -y); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.52e+16], t, If[LessEqual[y, 2.3e+44], N[(x * N[(t / (-y)), $MachinePrecision]), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.52 \cdot 10^{+16}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 2.3 \cdot 10^{+44}:\\
\;\;\;\;x \cdot \frac{t}{-y}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -1.52e16 or 2.30000000000000004e44 < y Initial program 99.6%
Taylor expanded in x around 0 64.8%
if -1.52e16 < y < 2.30000000000000004e44Initial program 96.4%
Taylor expanded in x around 0 97.7%
associate-*r/89.5%
*-commutative89.5%
associate-/r/97.5%
Simplified97.5%
Taylor expanded in z around 0 59.5%
mul-1-neg59.5%
associate-*r/59.5%
sub-neg59.5%
Simplified59.5%
Taylor expanded in x around inf 48.8%
associate-*l/46.1%
associate-*r*46.1%
neg-mul-146.1%
*-commutative46.1%
distribute-neg-frac246.1%
Simplified46.1%
(FPCore (x y z t) :precision binary64 (+ t (* (- z t) (/ x y))))
double code(double x, double y, double z, double t) {
return t + ((z - t) * (x / y));
}
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 + ((z - t) * (x / y))
end function
public static double code(double x, double y, double z, double t) {
return t + ((z - t) * (x / y));
}
def code(x, y, z, t): return t + ((z - t) * (x / y))
function code(x, y, z, t) return Float64(t + Float64(Float64(z - t) * Float64(x / y))) end
function tmp = code(x, y, z, t) tmp = t + ((z - t) * (x / y)); end
code[x_, y_, z_, t_] := N[(t + N[(N[(z - t), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
t + \left(z - t\right) \cdot \frac{x}{y}
\end{array}
Initial program 97.9%
Final simplification97.9%
(FPCore (x y z t) :precision binary64 (* t (- 1.0 (/ x y))))
double code(double x, double y, double z, double t) {
return t * (1.0 - (x / y));
}
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 * (1.0d0 - (x / y))
end function
public static double code(double x, double y, double z, double t) {
return t * (1.0 - (x / y));
}
def code(x, y, z, t): return t * (1.0 - (x / y))
function code(x, y, z, t) return Float64(t * Float64(1.0 - Float64(x / y))) end
function tmp = code(x, y, z, t) tmp = t * (1.0 - (x / y)); end
code[x_, y_, z_, t_] := N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
t \cdot \left(1 - \frac{x}{y}\right)
\end{array}
Initial program 97.9%
Taylor expanded in z around 0 62.7%
mul-1-neg62.7%
*-rgt-identity62.7%
associate-/l*66.5%
distribute-rgt-neg-in66.5%
mul-1-neg66.5%
distribute-lft-in66.5%
mul-1-neg66.5%
unsub-neg66.5%
Simplified66.5%
(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 36.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 2024135
(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))