
(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 11 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 (<= (/ x y) 5e+167) (fma (/ x y) (- z t) t) (fma x (* (- z t) (/ 1.0 y)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= 5e+167) {
tmp = fma((x / y), (z - t), t);
} else {
tmp = fma(x, ((z - t) * (1.0 / y)), t);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= 5e+167) tmp = fma(Float64(x / y), Float64(z - t), t); else tmp = fma(x, Float64(Float64(z - t) * Float64(1.0 / y)), t); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], 5e+167], N[(N[(x / y), $MachinePrecision] * N[(z - t), $MachinePrecision] + t), $MachinePrecision], N[(x * N[(N[(z - t), $MachinePrecision] * N[(1.0 / y), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq 5 \cdot 10^{+167}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{y}, z - t, t\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, \left(z - t\right) \cdot \frac{1}{y}, t\right)\\
\end{array}
\end{array}
if (/.f64 x y) < 4.9999999999999997e167Initial program 98.1%
fma-define98.1%
Simplified98.1%
if 4.9999999999999997e167 < (/.f64 x y) Initial program 82.4%
associate-*l/99.9%
associate-/l*99.9%
fma-define99.9%
Simplified99.9%
clear-num99.8%
associate-/r/100.0%
Applied egg-rr100.0%
Final simplification98.4%
(FPCore (x y z t) :precision binary64 (if (<= (/ x y) 5e+167) (fma (/ x y) (- z t) t) (fma x (/ (- z t) y) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= 5e+167) {
tmp = fma((x / y), (z - t), t);
} else {
tmp = fma(x, ((z - t) / y), t);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= 5e+167) tmp = fma(Float64(x / y), Float64(z - t), t); else tmp = fma(x, Float64(Float64(z - t) / y), t); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], 5e+167], N[(N[(x / y), $MachinePrecision] * N[(z - t), $MachinePrecision] + t), $MachinePrecision], N[(x * N[(N[(z - t), $MachinePrecision] / y), $MachinePrecision] + t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq 5 \cdot 10^{+167}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{y}, z - t, t\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, \frac{z - t}{y}, t\right)\\
\end{array}
\end{array}
if (/.f64 x y) < 4.9999999999999997e167Initial program 98.1%
fma-define98.1%
Simplified98.1%
if 4.9999999999999997e167 < (/.f64 x y) Initial program 82.4%
associate-*l/99.9%
associate-/l*99.9%
fma-define99.9%
Simplified99.9%
(FPCore (x y z t) :precision binary64 (if (<= (/ x y) 5e+167) (+ t (* (/ x y) (- z t))) (fma x (/ (- z t) y) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= 5e+167) {
tmp = t + ((x / y) * (z - t));
} else {
tmp = fma(x, ((z - t) / y), t);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= 5e+167) tmp = Float64(t + Float64(Float64(x / y) * Float64(z - t))); else tmp = fma(x, Float64(Float64(z - t) / y), t); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], 5e+167], N[(t + N[(N[(x / y), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(z - t), $MachinePrecision] / y), $MachinePrecision] + t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq 5 \cdot 10^{+167}:\\
\;\;\;\;t + \frac{x}{y} \cdot \left(z - t\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, \frac{z - t}{y}, t\right)\\
\end{array}
\end{array}
if (/.f64 x y) < 4.9999999999999997e167Initial program 98.1%
if 4.9999999999999997e167 < (/.f64 x y) Initial program 82.4%
associate-*l/99.9%
associate-/l*99.9%
fma-define99.9%
Simplified99.9%
Final simplification98.3%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.45e-54) (not (<= t 8.5e-19))) (* t (- 1.0 (/ x y))) (+ t (/ x (/ y z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.45e-54) || !(t <= 8.5e-19)) {
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 <= (-1.45d-54)) .or. (.not. (t <= 8.5d-19))) 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 <= -1.45e-54) || !(t <= 8.5e-19)) {
tmp = t * (1.0 - (x / y));
} else {
tmp = t + (x / (y / z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1.45e-54) or not (t <= 8.5e-19): 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 <= -1.45e-54) || !(t <= 8.5e-19)) tmp = Float64(t * Float64(1.0 - Float64(x / y))); else tmp = Float64(t + Float64(x / Float64(y / z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -1.45e-54) || ~((t <= 8.5e-19))) 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, -1.45e-54], N[Not[LessEqual[t, 8.5e-19]], $MachinePrecision]], N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t + N[(x / N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.45 \cdot 10^{-54} \lor \neg \left(t \leq 8.5 \cdot 10^{-19}\right):\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;t + \frac{x}{\frac{y}{z}}\\
\end{array}
\end{array}
if t < -1.45000000000000007e-54 or 8.50000000000000003e-19 < t Initial program 99.9%
Taylor expanded in z around 0 83.7%
*-commutative83.7%
associate-*l/88.4%
neg-mul-188.4%
*-lft-identity88.4%
distribute-lft-neg-in88.4%
mul-1-neg88.4%
distribute-rgt-in88.4%
mul-1-neg88.4%
unsub-neg88.4%
Simplified88.4%
if -1.45000000000000007e-54 < t < 8.50000000000000003e-19Initial program 91.9%
Taylor expanded in z around inf 83.1%
associate-/l*83.6%
Simplified83.6%
clear-num83.6%
un-div-inv83.9%
Applied egg-rr83.9%
Final simplification86.4%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.8e-50) (not (<= t 3.1e-18))) (* t (- 1.0 (/ x y))) (+ t (* x (/ z y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.8e-50) || !(t <= 3.1e-18)) {
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.8d-50)) .or. (.not. (t <= 3.1d-18))) 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.8e-50) || !(t <= 3.1e-18)) {
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.8e-50) or not (t <= 3.1e-18): 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.8e-50) || !(t <= 3.1e-18)) 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.8e-50) || ~((t <= 3.1e-18))) 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.8e-50], N[Not[LessEqual[t, 3.1e-18]], $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.8 \cdot 10^{-50} \lor \neg \left(t \leq 3.1 \cdot 10^{-18}\right):\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;t + x \cdot \frac{z}{y}\\
\end{array}
\end{array}
if t < -1.7999999999999999e-50 or 3.10000000000000007e-18 < t Initial program 99.9%
Taylor expanded in z around 0 83.7%
*-commutative83.7%
associate-*l/88.4%
neg-mul-188.4%
*-lft-identity88.4%
distribute-lft-neg-in88.4%
mul-1-neg88.4%
distribute-rgt-in88.4%
mul-1-neg88.4%
unsub-neg88.4%
Simplified88.4%
if -1.7999999999999999e-50 < t < 3.10000000000000007e-18Initial program 91.9%
Taylor expanded in z around inf 83.1%
associate-/l*83.6%
Simplified83.6%
Final simplification86.2%
(FPCore (x y z t) :precision binary64 (if (<= t -2.6e-50) (- t (/ t (/ y x))) (if (<= t 1.45e-18) (+ t (/ x (/ y z))) (- t (* (/ x y) t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -2.6e-50) {
tmp = t - (t / (y / x));
} else if (t <= 1.45e-18) {
tmp = t + (x / (y / z));
} else {
tmp = t - ((x / y) * t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (t <= (-2.6d-50)) then
tmp = t - (t / (y / x))
else if (t <= 1.45d-18) then
tmp = t + (x / (y / z))
else
tmp = t - ((x / y) * t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -2.6e-50) {
tmp = t - (t / (y / x));
} else if (t <= 1.45e-18) {
tmp = t + (x / (y / z));
} else {
tmp = t - ((x / y) * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -2.6e-50: tmp = t - (t / (y / x)) elif t <= 1.45e-18: tmp = t + (x / (y / z)) else: tmp = t - ((x / y) * t) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -2.6e-50) tmp = Float64(t - Float64(t / Float64(y / x))); elseif (t <= 1.45e-18) tmp = Float64(t + Float64(x / Float64(y / z))); else tmp = Float64(t - Float64(Float64(x / y) * t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -2.6e-50) tmp = t - (t / (y / x)); elseif (t <= 1.45e-18) tmp = t + (x / (y / z)); else tmp = t - ((x / y) * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -2.6e-50], N[(t - N[(t / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.45e-18], N[(t + N[(x / N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t - N[(N[(x / y), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.6 \cdot 10^{-50}:\\
\;\;\;\;t - \frac{t}{\frac{y}{x}}\\
\mathbf{elif}\;t \leq 1.45 \cdot 10^{-18}:\\
\;\;\;\;t + \frac{x}{\frac{y}{z}}\\
\mathbf{else}:\\
\;\;\;\;t - \frac{x}{y} \cdot t\\
\end{array}
\end{array}
if t < -2.6000000000000001e-50Initial program 99.9%
Taylor expanded in x around 0 93.4%
associate-*r/86.8%
*-commutative86.8%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in z around 0 83.6%
mul-1-neg83.6%
associate-*r/87.5%
rem-square-sqrt49.7%
distribute-lft-neg-in49.7%
cancel-sign-sub-inv49.7%
rem-square-sqrt87.5%
Simplified87.5%
clear-num87.4%
un-div-inv87.5%
Applied egg-rr87.5%
if -2.6000000000000001e-50 < t < 1.45e-18Initial program 91.9%
Taylor expanded in z around inf 83.1%
associate-/l*83.6%
Simplified83.6%
clear-num83.6%
un-div-inv83.9%
Applied egg-rr83.9%
if 1.45e-18 < t Initial program 99.9%
Taylor expanded in x around 0 94.1%
associate-*r/89.6%
*-commutative89.6%
associate-/r/99.8%
Simplified99.8%
Taylor expanded in z around 0 83.9%
mul-1-neg83.9%
associate-*r/89.5%
rem-square-sqrt50.6%
distribute-lft-neg-in50.6%
cancel-sign-sub-inv50.6%
rem-square-sqrt89.5%
Simplified89.5%
Final simplification86.4%
(FPCore (x y z t) :precision binary64 (if (<= t -7e-51) (* t (- 1.0 (/ x y))) (if (<= t 1.75e-18) (+ t (/ x (/ y z))) (- t (* (/ x y) t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -7e-51) {
tmp = t * (1.0 - (x / y));
} else if (t <= 1.75e-18) {
tmp = t + (x / (y / z));
} else {
tmp = t - ((x / y) * t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (t <= (-7d-51)) then
tmp = t * (1.0d0 - (x / y))
else if (t <= 1.75d-18) then
tmp = t + (x / (y / z))
else
tmp = t - ((x / y) * t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -7e-51) {
tmp = t * (1.0 - (x / y));
} else if (t <= 1.75e-18) {
tmp = t + (x / (y / z));
} else {
tmp = t - ((x / y) * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -7e-51: tmp = t * (1.0 - (x / y)) elif t <= 1.75e-18: tmp = t + (x / (y / z)) else: tmp = t - ((x / y) * t) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -7e-51) tmp = Float64(t * Float64(1.0 - Float64(x / y))); elseif (t <= 1.75e-18) tmp = Float64(t + Float64(x / Float64(y / z))); else tmp = Float64(t - Float64(Float64(x / y) * t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -7e-51) tmp = t * (1.0 - (x / y)); elseif (t <= 1.75e-18) tmp = t + (x / (y / z)); else tmp = t - ((x / y) * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -7e-51], N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.75e-18], N[(t + N[(x / N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t - N[(N[(x / y), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -7 \cdot 10^{-51}:\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\
\mathbf{elif}\;t \leq 1.75 \cdot 10^{-18}:\\
\;\;\;\;t + \frac{x}{\frac{y}{z}}\\
\mathbf{else}:\\
\;\;\;\;t - \frac{x}{y} \cdot t\\
\end{array}
\end{array}
if t < -6.9999999999999995e-51Initial program 99.9%
Taylor expanded in z around 0 83.6%
*-commutative83.6%
associate-*l/87.5%
neg-mul-187.5%
*-lft-identity87.5%
distribute-lft-neg-in87.5%
mul-1-neg87.5%
distribute-rgt-in87.5%
mul-1-neg87.5%
unsub-neg87.5%
Simplified87.5%
if -6.9999999999999995e-51 < t < 1.7499999999999999e-18Initial program 91.9%
Taylor expanded in z around inf 83.1%
associate-/l*83.6%
Simplified83.6%
clear-num83.6%
un-div-inv83.9%
Applied egg-rr83.9%
if 1.7499999999999999e-18 < t Initial program 99.9%
Taylor expanded in x around 0 94.1%
associate-*r/89.6%
*-commutative89.6%
associate-/r/99.8%
Simplified99.8%
Taylor expanded in z around 0 83.9%
mul-1-neg83.9%
associate-*r/89.5%
rem-square-sqrt50.6%
distribute-lft-neg-in50.6%
cancel-sign-sub-inv50.6%
rem-square-sqrt89.5%
Simplified89.5%
Final simplification86.4%
(FPCore (x y z t) :precision binary64 (if (<= (/ x y) 5e+160) (+ t (* (/ x y) (- z t))) (+ t (/ x (/ y (- z t))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= 5e+160) {
tmp = t + ((x / y) * (z - t));
} else {
tmp = t + (x / (y / (z - t)));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x / y) <= 5d+160) then
tmp = t + ((x / y) * (z - t))
else
tmp = t + (x / (y / (z - t)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= 5e+160) {
tmp = t + ((x / y) * (z - t));
} else {
tmp = t + (x / (y / (z - t)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= 5e+160: tmp = t + ((x / y) * (z - t)) else: tmp = t + (x / (y / (z - t))) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= 5e+160) tmp = Float64(t + Float64(Float64(x / y) * Float64(z - t))); else tmp = Float64(t + Float64(x / Float64(y / Float64(z - t)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x / y) <= 5e+160) tmp = t + ((x / y) * (z - t)); else tmp = t + (x / (y / (z - t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], 5e+160], N[(t + N[(N[(x / y), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t + N[(x / N[(y / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq 5 \cdot 10^{+160}:\\
\;\;\;\;t + \frac{x}{y} \cdot \left(z - t\right)\\
\mathbf{else}:\\
\;\;\;\;t + \frac{x}{\frac{y}{z - t}}\\
\end{array}
\end{array}
if (/.f64 x y) < 5.0000000000000002e160Initial program 98.1%
if 5.0000000000000002e160 < (/.f64 x y) Initial program 84.8%
div-inv84.8%
associate-*l*99.9%
associate-/r/99.8%
un-div-inv99.8%
Applied egg-rr99.8%
Final simplification98.3%
(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 96.2%
Final simplification96.2%
(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 96.2%
Taylor expanded in z around 0 60.9%
*-commutative60.9%
associate-*l/64.6%
neg-mul-164.6%
*-lft-identity64.6%
distribute-lft-neg-in64.6%
mul-1-neg64.6%
distribute-rgt-in64.6%
mul-1-neg64.6%
unsub-neg64.6%
Simplified64.6%
(FPCore (x y z t) :precision binary64 t)
double code(double x, double y, double z, double t) {
return t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = t
end function
public static double code(double x, double y, double z, double t) {
return t;
}
def code(x, y, z, t): return t
function code(x, y, z, t) return t end
function tmp = code(x, y, z, t) tmp = t; end
code[x_, y_, z_, t_] := t
\begin{array}{l}
\\
t
\end{array}
Initial program 96.2%
Taylor expanded in x around 0 34.1%
(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 2024146
(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))