
(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 98.8%
Taylor expanded in x around 0 93.5%
associate-*r/92.2%
*-commutative92.2%
associate-/r/99.0%
Simplified99.0%
Final simplification99.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (/ x y) (- t))))
(if (<= x -2.35e+120)
t_1
(if (<= x -3.3e-66)
(/ (* z x) y)
(if (<= x 8.6e-33) t (if (<= x 1.15e+77) (* x (/ z y)) t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = (x / y) * -t;
double tmp;
if (x <= -2.35e+120) {
tmp = t_1;
} else if (x <= -3.3e-66) {
tmp = (z * x) / y;
} else if (x <= 8.6e-33) {
tmp = t;
} else if (x <= 1.15e+77) {
tmp = x * (z / y);
} 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) * -t
if (x <= (-2.35d+120)) then
tmp = t_1
else if (x <= (-3.3d-66)) then
tmp = (z * x) / y
else if (x <= 8.6d-33) then
tmp = t
else if (x <= 1.15d+77) then
tmp = x * (z / y)
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) * -t;
double tmp;
if (x <= -2.35e+120) {
tmp = t_1;
} else if (x <= -3.3e-66) {
tmp = (z * x) / y;
} else if (x <= 8.6e-33) {
tmp = t;
} else if (x <= 1.15e+77) {
tmp = x * (z / y);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x / y) * -t tmp = 0 if x <= -2.35e+120: tmp = t_1 elif x <= -3.3e-66: tmp = (z * x) / y elif x <= 8.6e-33: tmp = t elif x <= 1.15e+77: tmp = x * (z / y) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x / y) * Float64(-t)) tmp = 0.0 if (x <= -2.35e+120) tmp = t_1; elseif (x <= -3.3e-66) tmp = Float64(Float64(z * x) / y); elseif (x <= 8.6e-33) tmp = t; elseif (x <= 1.15e+77) tmp = Float64(x * Float64(z / y)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x / y) * -t; tmp = 0.0; if (x <= -2.35e+120) tmp = t_1; elseif (x <= -3.3e-66) tmp = (z * x) / y; elseif (x <= 8.6e-33) tmp = t; elseif (x <= 1.15e+77) tmp = x * (z / y); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x / y), $MachinePrecision] * (-t)), $MachinePrecision]}, If[LessEqual[x, -2.35e+120], t$95$1, If[LessEqual[x, -3.3e-66], N[(N[(z * x), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[x, 8.6e-33], t, If[LessEqual[x, 1.15e+77], N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{y} \cdot \left(-t\right)\\
\mathbf{if}\;x \leq -2.35 \cdot 10^{+120}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -3.3 \cdot 10^{-66}:\\
\;\;\;\;\frac{z \cdot x}{y}\\
\mathbf{elif}\;x \leq 8.6 \cdot 10^{-33}:\\
\;\;\;\;t\\
\mathbf{elif}\;x \leq 1.15 \cdot 10^{+77}:\\
\;\;\;\;x \cdot \frac{z}{y}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -2.34999999999999997e120 or 1.14999999999999997e77 < x Initial program 98.7%
Taylor expanded in x around 0 86.4%
Taylor expanded in x around -inf 78.7%
Taylor expanded in z around 0 54.6%
mul-1-neg54.6%
associate-*r/63.3%
distribute-rgt-neg-out63.3%
distribute-neg-frac263.3%
Simplified63.3%
if -2.34999999999999997e120 < x < -3.2999999999999999e-66Initial program 99.7%
Taylor expanded in x around 0 99.8%
Taylor expanded in x around -inf 75.0%
Taylor expanded in z around inf 53.5%
if -3.2999999999999999e-66 < x < 8.60000000000000062e-33Initial program 99.2%
Taylor expanded in x around 0 63.9%
if 8.60000000000000062e-33 < x < 1.14999999999999997e77Initial program 96.6%
Taylor expanded in x around 0 96.5%
Taylor expanded in x around -inf 81.4%
Taylor expanded in z around inf 52.0%
associate-*r/52.0%
Simplified52.0%
Final simplification61.1%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -2e+21) (not (<= (/ x y) 15000000.0))) (/ (* (- z t) x) y) (+ t (* z (/ x y)))))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -2e+21) || !((x / y) <= 15000000.0)) {
tmp = ((z - t) * 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 (((x / y) <= (-2d+21)) .or. (.not. ((x / y) <= 15000000.0d0))) then
tmp = ((z - t) * 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 (((x / y) <= -2e+21) || !((x / y) <= 15000000.0)) {
tmp = ((z - t) * x) / y;
} else {
tmp = t + (z * (x / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -2e+21) or not ((x / y) <= 15000000.0): tmp = ((z - t) * x) / y else: tmp = t + (z * (x / y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -2e+21) || !(Float64(x / y) <= 15000000.0)) tmp = Float64(Float64(Float64(z - t) * 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 (((x / y) <= -2e+21) || ~(((x / y) <= 15000000.0))) tmp = ((z - t) * x) / y; else tmp = t + (z * (x / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -2e+21], N[Not[LessEqual[N[(x / y), $MachinePrecision], 15000000.0]], $MachinePrecision]], N[(N[(N[(z - t), $MachinePrecision] * x), $MachinePrecision] / y), $MachinePrecision], N[(t + N[(z * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -2 \cdot 10^{+21} \lor \neg \left(\frac{x}{y} \leq 15000000\right):\\
\;\;\;\;\frac{\left(z - t\right) \cdot x}{y}\\
\mathbf{else}:\\
\;\;\;\;t + z \cdot \frac{x}{y}\\
\end{array}
\end{array}
if (/.f64 x y) < -2e21 or 1.5e7 < (/.f64 x y) Initial program 98.2%
Taylor expanded in x around 0 94.6%
Taylor expanded in x around -inf 94.2%
if -2e21 < (/.f64 x y) < 1.5e7Initial program 99.4%
Taylor expanded in z around inf 98.6%
Final simplification96.5%
(FPCore (x y z t) :precision binary64 (if (or (<= z -8.8e-85) (not (<= z 8.4e-66))) (+ t (* z (/ x y))) (- t (/ t (/ y x)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -8.8e-85) || !(z <= 8.4e-66)) {
tmp = t + (z * (x / y));
} else {
tmp = t - (t / (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 ((z <= (-8.8d-85)) .or. (.not. (z <= 8.4d-66))) then
tmp = t + (z * (x / y))
else
tmp = t - (t / (y / x))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -8.8e-85) || !(z <= 8.4e-66)) {
tmp = t + (z * (x / y));
} else {
tmp = t - (t / (y / x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -8.8e-85) or not (z <= 8.4e-66): tmp = t + (z * (x / y)) else: tmp = t - (t / (y / x)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -8.8e-85) || !(z <= 8.4e-66)) tmp = Float64(t + Float64(z * Float64(x / y))); else tmp = Float64(t - Float64(t / Float64(y / x))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -8.8e-85) || ~((z <= 8.4e-66))) tmp = t + (z * (x / y)); else tmp = t - (t / (y / x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -8.8e-85], N[Not[LessEqual[z, 8.4e-66]], $MachinePrecision]], N[(t + N[(z * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t - N[(t / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.8 \cdot 10^{-85} \lor \neg \left(z \leq 8.4 \cdot 10^{-66}\right):\\
\;\;\;\;t + z \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;t - \frac{t}{\frac{y}{x}}\\
\end{array}
\end{array}
if z < -8.8e-85 or 8.4000000000000001e-66 < z Initial program 99.3%
Taylor expanded in z around inf 87.7%
if -8.8e-85 < z < 8.4000000000000001e-66Initial program 98.1%
Taylor expanded in x around 0 92.8%
associate-*r/95.5%
*-commutative95.5%
associate-/r/98.7%
Simplified98.7%
Taylor expanded in z around 0 89.8%
mul-1-neg89.8%
associate-*r/92.5%
rem-square-sqrt54.9%
distribute-lft-neg-in54.9%
cancel-sign-sub-inv54.9%
rem-square-sqrt92.5%
Simplified92.5%
clear-num92.5%
div-inv93.1%
Applied egg-rr93.1%
Final simplification90.0%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.6e-85) (not (<= z 3.9e-66))) (+ t (* z (/ x y))) (- t (* t (/ x y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.6e-85) || !(z <= 3.9e-66)) {
tmp = t + (z * (x / y));
} else {
tmp = t - (t * (x / y));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-1.6d-85)) .or. (.not. (z <= 3.9d-66))) then
tmp = t + (z * (x / y))
else
tmp = t - (t * (x / y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.6e-85) || !(z <= 3.9e-66)) {
tmp = t + (z * (x / y));
} else {
tmp = t - (t * (x / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.6e-85) or not (z <= 3.9e-66): tmp = t + (z * (x / y)) else: tmp = t - (t * (x / y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.6e-85) || !(z <= 3.9e-66)) tmp = Float64(t + Float64(z * Float64(x / y))); else tmp = Float64(t - Float64(t * Float64(x / y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.6e-85) || ~((z <= 3.9e-66))) tmp = t + (z * (x / y)); else tmp = t - (t * (x / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.6e-85], N[Not[LessEqual[z, 3.9e-66]], $MachinePrecision]], N[(t + N[(z * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t - N[(t * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.6 \cdot 10^{-85} \lor \neg \left(z \leq 3.9 \cdot 10^{-66}\right):\\
\;\;\;\;t + z \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;t - t \cdot \frac{x}{y}\\
\end{array}
\end{array}
if z < -1.60000000000000014e-85 or 3.89999999999999983e-66 < z Initial program 99.3%
Taylor expanded in z around inf 87.7%
if -1.60000000000000014e-85 < z < 3.89999999999999983e-66Initial program 98.1%
Taylor expanded in x around 0 92.8%
associate-*r/95.5%
*-commutative95.5%
associate-/r/98.7%
Simplified98.7%
Taylor expanded in z around 0 89.8%
mul-1-neg89.8%
associate-*r/92.5%
rem-square-sqrt54.9%
distribute-lft-neg-in54.9%
cancel-sign-sub-inv54.9%
rem-square-sqrt92.5%
Simplified92.5%
Final simplification89.7%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.02e-84) (not (<= z 2.3e-65))) (+ t (* z (/ x y))) (* t (- 1.0 (/ x y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.02e-84) || !(z <= 2.3e-65)) {
tmp = t + (z * (x / y));
} else {
tmp = t * (1.0 - (x / y));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-1.02d-84)) .or. (.not. (z <= 2.3d-65))) then
tmp = t + (z * (x / y))
else
tmp = t * (1.0d0 - (x / y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.02e-84) || !(z <= 2.3e-65)) {
tmp = t + (z * (x / y));
} else {
tmp = t * (1.0 - (x / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.02e-84) or not (z <= 2.3e-65): tmp = t + (z * (x / y)) else: tmp = t * (1.0 - (x / y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.02e-84) || !(z <= 2.3e-65)) tmp = Float64(t + Float64(z * Float64(x / y))); else tmp = Float64(t * Float64(1.0 - Float64(x / y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.02e-84) || ~((z <= 2.3e-65))) tmp = t + (z * (x / y)); else tmp = t * (1.0 - (x / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.02e-84], N[Not[LessEqual[z, 2.3e-65]], $MachinePrecision]], N[(t + N[(z * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.02 \cdot 10^{-84} \lor \neg \left(z \leq 2.3 \cdot 10^{-65}\right):\\
\;\;\;\;t + z \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\
\end{array}
\end{array}
if z < -1.02000000000000004e-84 or 2.3e-65 < z Initial program 99.3%
Taylor expanded in z around inf 87.7%
if -1.02000000000000004e-84 < z < 2.3e-65Initial program 98.1%
Taylor expanded in z around 0 89.8%
*-commutative89.8%
associate-*l/92.5%
neg-mul-192.5%
*-lft-identity92.5%
distribute-lft-neg-in92.5%
mul-1-neg92.5%
distribute-rgt-in92.5%
mul-1-neg92.5%
unsub-neg92.5%
Simplified92.5%
Final simplification89.7%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.02e-84) (not (<= z 3.6e-65))) (+ t (* x (/ z y))) (* t (- 1.0 (/ x y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.02e-84) || !(z <= 3.6e-65)) {
tmp = t + (x * (z / y));
} else {
tmp = t * (1.0 - (x / y));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-1.02d-84)) .or. (.not. (z <= 3.6d-65))) then
tmp = t + (x * (z / y))
else
tmp = t * (1.0d0 - (x / y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.02e-84) || !(z <= 3.6e-65)) {
tmp = t + (x * (z / y));
} else {
tmp = t * (1.0 - (x / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.02e-84) or not (z <= 3.6e-65): tmp = t + (x * (z / y)) else: tmp = t * (1.0 - (x / y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.02e-84) || !(z <= 3.6e-65)) tmp = Float64(t + Float64(x * Float64(z / y))); else tmp = Float64(t * Float64(1.0 - Float64(x / y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.02e-84) || ~((z <= 3.6e-65))) tmp = t + (x * (z / y)); else tmp = t * (1.0 - (x / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.02e-84], N[Not[LessEqual[z, 3.6e-65]], $MachinePrecision]], N[(t + N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.02 \cdot 10^{-84} \lor \neg \left(z \leq 3.6 \cdot 10^{-65}\right):\\
\;\;\;\;t + x \cdot \frac{z}{y}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\
\end{array}
\end{array}
if z < -1.02000000000000004e-84 or 3.5999999999999998e-65 < z Initial program 99.3%
Taylor expanded in z around inf 83.9%
associate-/l*82.5%
Simplified82.5%
if -1.02000000000000004e-84 < z < 3.5999999999999998e-65Initial program 98.1%
Taylor expanded in z around 0 89.8%
*-commutative89.8%
associate-*l/92.5%
neg-mul-192.5%
*-lft-identity92.5%
distribute-lft-neg-in92.5%
mul-1-neg92.5%
distribute-rgt-in92.5%
mul-1-neg92.5%
unsub-neg92.5%
Simplified92.5%
Final simplification86.7%
(FPCore (x y z t) :precision binary64 (if (<= z -7.4e+67) (* x (/ z y)) (if (<= z 2.9e+191) (* t (- 1.0 (/ x y))) (/ (* z x) y))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -7.4e+67) {
tmp = x * (z / y);
} else if (z <= 2.9e+191) {
tmp = t * (1.0 - (x / y));
} else {
tmp = (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 (z <= (-7.4d+67)) then
tmp = x * (z / y)
else if (z <= 2.9d+191) then
tmp = t * (1.0d0 - (x / y))
else
tmp = (z * x) / y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -7.4e+67) {
tmp = x * (z / y);
} else if (z <= 2.9e+191) {
tmp = t * (1.0 - (x / y));
} else {
tmp = (z * x) / y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -7.4e+67: tmp = x * (z / y) elif z <= 2.9e+191: tmp = t * (1.0 - (x / y)) else: tmp = (z * x) / y return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -7.4e+67) tmp = Float64(x * Float64(z / y)); elseif (z <= 2.9e+191) tmp = Float64(t * Float64(1.0 - Float64(x / y))); else tmp = Float64(Float64(z * x) / y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -7.4e+67) tmp = x * (z / y); elseif (z <= 2.9e+191) tmp = t * (1.0 - (x / y)); else tmp = (z * x) / y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -7.4e+67], N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.9e+191], N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z * x), $MachinePrecision] / y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.4 \cdot 10^{+67}:\\
\;\;\;\;x \cdot \frac{z}{y}\\
\mathbf{elif}\;z \leq 2.9 \cdot 10^{+191}:\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{z \cdot x}{y}\\
\end{array}
\end{array}
if z < -7.3999999999999995e67Initial program 99.8%
Taylor expanded in x around 0 94.0%
Taylor expanded in x around -inf 79.3%
Taylor expanded in z around inf 74.2%
associate-*r/77.9%
Simplified77.9%
if -7.3999999999999995e67 < z < 2.9000000000000001e191Initial program 98.7%
Taylor expanded in z around 0 77.1%
*-commutative77.1%
associate-*l/80.3%
neg-mul-180.3%
*-lft-identity80.3%
distribute-lft-neg-in80.3%
mul-1-neg80.3%
distribute-rgt-in80.3%
mul-1-neg80.3%
unsub-neg80.3%
Simplified80.3%
if 2.9000000000000001e191 < z Initial program 97.6%
Taylor expanded in x around 0 90.6%
Taylor expanded in x around -inf 61.1%
Taylor expanded in z around inf 61.2%
Final simplification77.6%
(FPCore (x y z t) :precision binary64 (if (or (<= z -7.2e-15) (not (<= z 7.5e-68))) (* x (/ z y)) t))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -7.2e-15) || !(z <= 7.5e-68)) {
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 ((z <= (-7.2d-15)) .or. (.not. (z <= 7.5d-68))) 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 ((z <= -7.2e-15) || !(z <= 7.5e-68)) {
tmp = x * (z / y);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -7.2e-15) or not (z <= 7.5e-68): tmp = x * (z / y) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -7.2e-15) || !(z <= 7.5e-68)) 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 ((z <= -7.2e-15) || ~((z <= 7.5e-68))) tmp = x * (z / y); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -7.2e-15], N[Not[LessEqual[z, 7.5e-68]], $MachinePrecision]], N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision], t]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.2 \cdot 10^{-15} \lor \neg \left(z \leq 7.5 \cdot 10^{-68}\right):\\
\;\;\;\;x \cdot \frac{z}{y}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if z < -7.2000000000000002e-15 or 7.50000000000000081e-68 < z Initial program 99.3%
Taylor expanded in x around 0 93.7%
Taylor expanded in x around -inf 70.4%
Taylor expanded in z around inf 59.0%
associate-*r/57.6%
Simplified57.6%
if -7.2000000000000002e-15 < z < 7.50000000000000081e-68Initial program 98.3%
Taylor expanded in x around 0 50.5%
Final simplification54.4%
(FPCore (x y z t) :precision binary64 (if (<= z -2.6e-14) (* x (/ z y)) (if (<= z 6.8e-68) t (/ (* z x) y))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.6e-14) {
tmp = x * (z / y);
} else if (z <= 6.8e-68) {
tmp = t;
} else {
tmp = (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 (z <= (-2.6d-14)) then
tmp = x * (z / y)
else if (z <= 6.8d-68) then
tmp = t
else
tmp = (z * x) / y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.6e-14) {
tmp = x * (z / y);
} else if (z <= 6.8e-68) {
tmp = t;
} else {
tmp = (z * x) / y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -2.6e-14: tmp = x * (z / y) elif z <= 6.8e-68: tmp = t else: tmp = (z * x) / y return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -2.6e-14) tmp = Float64(x * Float64(z / y)); elseif (z <= 6.8e-68) tmp = t; else tmp = Float64(Float64(z * x) / y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -2.6e-14) tmp = x * (z / y); elseif (z <= 6.8e-68) tmp = t; else tmp = (z * x) / y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -2.6e-14], N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 6.8e-68], t, N[(N[(z * x), $MachinePrecision] / y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.6 \cdot 10^{-14}:\\
\;\;\;\;x \cdot \frac{z}{y}\\
\mathbf{elif}\;z \leq 6.8 \cdot 10^{-68}:\\
\;\;\;\;t\\
\mathbf{else}:\\
\;\;\;\;\frac{z \cdot x}{y}\\
\end{array}
\end{array}
if z < -2.59999999999999997e-14Initial program 99.8%
Taylor expanded in x around 0 95.4%
Taylor expanded in x around -inf 74.9%
Taylor expanded in z around inf 68.0%
associate-*r/69.4%
Simplified69.4%
if -2.59999999999999997e-14 < z < 6.80000000000000037e-68Initial program 98.3%
Taylor expanded in x around 0 50.5%
if 6.80000000000000037e-68 < z Initial program 98.8%
Taylor expanded in x around 0 92.2%
Taylor expanded in x around -inf 66.6%
Taylor expanded in z around inf 51.2%
Final simplification55.5%
(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 98.8%
Final simplification98.8%
(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 98.8%
Taylor expanded in x around 0 37.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 2024136
(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))