
(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 (+ t (* (/ x y) (- z t))))
double code(double x, double y, double z, double t) {
return t + ((x / y) * (z - t));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = t + ((x / y) * (z - t))
end function
public static double code(double x, double y, double z, double t) {
return t + ((x / y) * (z - t));
}
def code(x, y, z, t): return t + ((x / y) * (z - t))
function code(x, y, z, t) return Float64(t + Float64(Float64(x / y) * Float64(z - t))) end
function tmp = code(x, y, z, t) tmp = t + ((x / y) * (z - t)); end
code[x_, y_, z_, t_] := N[(t + N[(N[(x / y), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
t + \frac{x}{y} \cdot \left(z - t\right)
\end{array}
Initial program 97.7%
Final simplification97.7%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -2000.0) (not (<= (/ x y) 2e-6))) (/ (- t) (/ y x)) t))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -2000.0) || !((x / y) <= 2e-6)) {
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 (((x / y) <= (-2000.0d0)) .or. (.not. ((x / y) <= 2d-6))) 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 (((x / y) <= -2000.0) || !((x / y) <= 2e-6)) {
tmp = -t / (y / x);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -2000.0) or not ((x / y) <= 2e-6): tmp = -t / (y / x) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -2000.0) || !(Float64(x / y) <= 2e-6)) 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 (((x / y) <= -2000.0) || ~(((x / y) <= 2e-6))) tmp = -t / (y / x); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -2000.0], N[Not[LessEqual[N[(x / y), $MachinePrecision], 2e-6]], $MachinePrecision]], N[((-t) / N[(y / x), $MachinePrecision]), $MachinePrecision], t]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -2000 \lor \neg \left(\frac{x}{y} \leq 2 \cdot 10^{-6}\right):\\
\;\;\;\;\frac{-t}{\frac{y}{x}}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if (/.f64 x y) < -2e3 or 1.99999999999999991e-6 < (/.f64 x y) Initial program 97.2%
Taylor expanded in z around 0 45.9%
mul-1-neg45.9%
unsub-neg45.9%
associate-*r/54.3%
Simplified54.3%
Taylor expanded in t around 0 54.3%
Taylor expanded in x around inf 45.9%
associate-*r/45.9%
neg-mul-145.9%
distribute-rgt-neg-out45.9%
associate-*r/53.3%
Simplified53.3%
distribute-frac-neg53.3%
distribute-rgt-neg-out53.3%
add-sqr-sqrt25.9%
sqrt-unprod27.4%
sqr-neg27.4%
sqrt-unprod4.2%
add-sqr-sqrt9.9%
clear-num9.9%
un-div-inv9.9%
add-sqr-sqrt4.3%
sqrt-unprod27.4%
sqr-neg27.4%
sqrt-unprod25.9%
add-sqr-sqrt52.6%
Applied egg-rr52.6%
if -2e3 < (/.f64 x y) < 1.99999999999999991e-6Initial program 98.3%
Taylor expanded in x around 0 82.5%
Final simplification65.9%
(FPCore (x y z t) :precision binary64 (if (<= (/ x y) -2000.0) (* t (/ (- x) y)) (if (<= (/ x y) 2e-6) t (/ (- t) (/ y x)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -2000.0) {
tmp = t * (-x / y);
} else if ((x / y) <= 2e-6) {
tmp = t;
} else {
tmp = -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 ((x / y) <= (-2000.0d0)) then
tmp = t * (-x / y)
else if ((x / y) <= 2d-6) then
tmp = t
else
tmp = -t / (y / x)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -2000.0) {
tmp = t * (-x / y);
} else if ((x / y) <= 2e-6) {
tmp = t;
} else {
tmp = -t / (y / x);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -2000.0: tmp = t * (-x / y) elif (x / y) <= 2e-6: tmp = t else: tmp = -t / (y / x) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -2000.0) tmp = Float64(t * Float64(Float64(-x) / y)); elseif (Float64(x / y) <= 2e-6) tmp = t; else tmp = Float64(Float64(-t) / Float64(y / x)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x / y) <= -2000.0) tmp = t * (-x / y); elseif ((x / y) <= 2e-6) tmp = t; else tmp = -t / (y / x); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -2000.0], N[(t * N[((-x) / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 2e-6], t, N[((-t) / N[(y / x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -2000:\\
\;\;\;\;t \cdot \frac{-x}{y}\\
\mathbf{elif}\;\frac{x}{y} \leq 2 \cdot 10^{-6}:\\
\;\;\;\;t\\
\mathbf{else}:\\
\;\;\;\;\frac{-t}{\frac{y}{x}}\\
\end{array}
\end{array}
if (/.f64 x y) < -2e3Initial program 97.3%
Taylor expanded in z around 0 46.2%
mul-1-neg46.2%
unsub-neg46.2%
associate-*r/52.4%
Simplified52.4%
Taylor expanded in t around 0 52.4%
Taylor expanded in x around inf 46.1%
associate-*r/46.1%
neg-mul-146.1%
distribute-rgt-neg-out46.1%
associate-*r/51.5%
Simplified51.5%
if -2e3 < (/.f64 x y) < 1.99999999999999991e-6Initial program 98.3%
Taylor expanded in x around 0 82.5%
if 1.99999999999999991e-6 < (/.f64 x y) Initial program 97.1%
Taylor expanded in z around 0 45.6%
mul-1-neg45.6%
unsub-neg45.6%
associate-*r/56.4%
Simplified56.4%
Taylor expanded in t around 0 56.4%
Taylor expanded in x around inf 45.7%
associate-*r/45.7%
neg-mul-145.7%
distribute-rgt-neg-out45.7%
associate-*r/55.2%
Simplified55.2%
distribute-frac-neg55.2%
distribute-rgt-neg-out55.2%
add-sqr-sqrt29.4%
sqrt-unprod35.0%
sqr-neg35.0%
sqrt-unprod5.3%
add-sqr-sqrt11.6%
clear-num11.6%
un-div-inv11.6%
add-sqr-sqrt5.3%
sqrt-unprod35.0%
sqr-neg35.0%
sqrt-unprod29.4%
add-sqr-sqrt55.2%
Applied egg-rr55.2%
Final simplification66.3%
(FPCore (x y z t) :precision binary64 (if (or (<= z -6.6e-64) (not (<= z 1.1e-19))) (+ t (* (/ x y) z)) (* t (- 1.0 (/ x y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -6.6e-64) || !(z <= 1.1e-19)) {
tmp = t + ((x / y) * z);
} 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 <= (-6.6d-64)) .or. (.not. (z <= 1.1d-19))) then
tmp = t + ((x / y) * z)
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 <= -6.6e-64) || !(z <= 1.1e-19)) {
tmp = t + ((x / y) * z);
} else {
tmp = t * (1.0 - (x / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -6.6e-64) or not (z <= 1.1e-19): tmp = t + ((x / y) * z) else: tmp = t * (1.0 - (x / y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -6.6e-64) || !(z <= 1.1e-19)) tmp = Float64(t + Float64(Float64(x / y) * z)); 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 <= -6.6e-64) || ~((z <= 1.1e-19))) tmp = t + ((x / y) * z); else tmp = t * (1.0 - (x / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -6.6e-64], N[Not[LessEqual[z, 1.1e-19]], $MachinePrecision]], N[(t + N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.6 \cdot 10^{-64} \lor \neg \left(z \leq 1.1 \cdot 10^{-19}\right):\\
\;\;\;\;t + \frac{x}{y} \cdot z\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\
\end{array}
\end{array}
if z < -6.5999999999999999e-64 or 1.0999999999999999e-19 < z Initial program 98.6%
Taylor expanded in z around inf 86.9%
associate-*l/88.8%
*-commutative88.8%
Simplified88.8%
if -6.5999999999999999e-64 < z < 1.0999999999999999e-19Initial program 96.5%
Taylor expanded in z around 0 81.4%
mul-1-neg81.4%
unsub-neg81.4%
associate-*r/88.9%
Simplified88.9%
Taylor expanded in t around 0 88.9%
Final simplification88.9%
(FPCore (x y z t) :precision binary64 (if (or (<= z -8.8e-52) (not (<= z 1.2e-19))) (+ t (/ z (/ y x))) (* t (- 1.0 (/ x y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -8.8e-52) || !(z <= 1.2e-19)) {
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 ((z <= (-8.8d-52)) .or. (.not. (z <= 1.2d-19))) 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 ((z <= -8.8e-52) || !(z <= 1.2e-19)) {
tmp = t + (z / (y / x));
} else {
tmp = t * (1.0 - (x / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -8.8e-52) or not (z <= 1.2e-19): tmp = t + (z / (y / x)) else: tmp = t * (1.0 - (x / y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -8.8e-52) || !(z <= 1.2e-19)) 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 ((z <= -8.8e-52) || ~((z <= 1.2e-19))) tmp = t + (z / (y / x)); else tmp = t * (1.0 - (x / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -8.8e-52], N[Not[LessEqual[z, 1.2e-19]], $MachinePrecision]], 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}\;z \leq -8.8 \cdot 10^{-52} \lor \neg \left(z \leq 1.2 \cdot 10^{-19}\right):\\
\;\;\;\;t + \frac{z}{\frac{y}{x}}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\
\end{array}
\end{array}
if z < -8.80000000000000036e-52 or 1.20000000000000011e-19 < z Initial program 98.6%
Taylor expanded in z around inf 87.2%
*-commutative87.2%
associate-/l*89.3%
Simplified89.3%
if -8.80000000000000036e-52 < z < 1.20000000000000011e-19Initial program 96.6%
Taylor expanded in z around 0 80.4%
mul-1-neg80.4%
unsub-neg80.4%
associate-*r/88.5%
Simplified88.5%
Taylor expanded in t around 0 88.5%
Final simplification88.9%
(FPCore (x y z t) :precision binary64 (if (or (<= z -5.8e-64) (not (<= z 2.02e-19))) (+ t (/ z (/ y x))) (- t (* (/ x y) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -5.8e-64) || !(z <= 2.02e-19)) {
tmp = t + (z / (y / x));
} 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 ((z <= (-5.8d-64)) .or. (.not. (z <= 2.02d-19))) then
tmp = t + (z / (y / x))
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 ((z <= -5.8e-64) || !(z <= 2.02e-19)) {
tmp = t + (z / (y / x));
} else {
tmp = t - ((x / y) * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -5.8e-64) or not (z <= 2.02e-19): tmp = t + (z / (y / x)) else: tmp = t - ((x / y) * t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -5.8e-64) || !(z <= 2.02e-19)) tmp = Float64(t + Float64(z / Float64(y / x))); 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 ((z <= -5.8e-64) || ~((z <= 2.02e-19))) tmp = t + (z / (y / x)); else tmp = t - ((x / y) * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -5.8e-64], N[Not[LessEqual[z, 2.02e-19]], $MachinePrecision]], N[(t + N[(z / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t - N[(N[(x / y), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.8 \cdot 10^{-64} \lor \neg \left(z \leq 2.02 \cdot 10^{-19}\right):\\
\;\;\;\;t + \frac{z}{\frac{y}{x}}\\
\mathbf{else}:\\
\;\;\;\;t - \frac{x}{y} \cdot t\\
\end{array}
\end{array}
if z < -5.7999999999999998e-64 or 2.01999999999999989e-19 < z Initial program 98.6%
Taylor expanded in z around inf 86.9%
*-commutative86.9%
associate-/l*88.9%
Simplified88.9%
if -5.7999999999999998e-64 < z < 2.01999999999999989e-19Initial program 96.5%
Taylor expanded in z around 0 81.4%
mul-1-neg81.4%
unsub-neg81.4%
associate-*r/88.9%
Simplified88.9%
Final simplification88.9%
(FPCore (x y z t) :precision binary64 (if (<= (/ x y) 1.45e+108) t (* (/ x y) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= 1.45e+108) {
tmp = t;
} else {
tmp = (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 ((x / y) <= 1.45d+108) then
tmp = t
else
tmp = (x / y) * t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= 1.45e+108) {
tmp = t;
} else {
tmp = (x / y) * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= 1.45e+108: tmp = t else: tmp = (x / y) * t return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= 1.45e+108) tmp = t; else tmp = Float64(Float64(x / y) * t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x / y) <= 1.45e+108) tmp = t; else tmp = (x / y) * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], 1.45e+108], t, N[(N[(x / y), $MachinePrecision] * t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq 1.45 \cdot 10^{+108}:\\
\;\;\;\;t\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} \cdot t\\
\end{array}
\end{array}
if (/.f64 x y) < 1.45000000000000004e108Initial program 98.0%
Taylor expanded in x around 0 47.7%
if 1.45000000000000004e108 < (/.f64 x y) Initial program 96.3%
Taylor expanded in z around 0 45.5%
mul-1-neg45.5%
unsub-neg45.5%
associate-*r/54.2%
Simplified54.2%
Taylor expanded in t around 0 54.2%
Taylor expanded in x around inf 45.5%
associate-*r/45.5%
neg-mul-145.5%
distribute-rgt-neg-out45.5%
associate-*r/54.2%
Simplified54.2%
*-commutative54.2%
div-inv54.2%
associate-*l*42.6%
associate-/r/41.9%
clear-num42.6%
distribute-lft-neg-in42.6%
distribute-rgt-neg-out42.6%
add-log-exp49.3%
*-un-lft-identity49.3%
log-prod49.3%
metadata-eval49.3%
add-log-exp42.6%
distribute-rgt-neg-out42.6%
distribute-lft-neg-in42.6%
clear-num41.9%
associate-/r/42.6%
associate-*l*54.2%
div-inv54.2%
clear-num54.1%
associate-*l/54.2%
*-un-lft-identity54.2%
add-sqr-sqrt28.6%
sqrt-unprod34.6%
sqr-neg34.6%
sqrt-unprod8.0%
add-sqr-sqrt14.9%
Applied egg-rr14.9%
+-lft-identity14.9%
associate-/l*7.6%
associate-*r/14.8%
Simplified14.8%
Final simplification41.0%
(FPCore (x y z t) :precision binary64 (if (<= (/ x y) 5e+97) t (/ t (/ y x))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= 5e+97) {
tmp = t;
} else {
tmp = 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 ((x / y) <= 5d+97) then
tmp = t
else
tmp = t / (y / x)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= 5e+97) {
tmp = t;
} else {
tmp = t / (y / x);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= 5e+97: tmp = t else: tmp = t / (y / x) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= 5e+97) tmp = t; else tmp = Float64(t / Float64(y / x)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x / y) <= 5e+97) tmp = t; else tmp = t / (y / x); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], 5e+97], t, N[(t / N[(y / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq 5 \cdot 10^{+97}:\\
\;\;\;\;t\\
\mathbf{else}:\\
\;\;\;\;\frac{t}{\frac{y}{x}}\\
\end{array}
\end{array}
if (/.f64 x y) < 4.99999999999999999e97Initial program 98.0%
Taylor expanded in x around 0 47.7%
if 4.99999999999999999e97 < (/.f64 x y) Initial program 96.3%
Taylor expanded in z around 0 45.5%
mul-1-neg45.5%
unsub-neg45.5%
associate-*r/54.2%
Simplified54.2%
Taylor expanded in t around 0 54.2%
Taylor expanded in x around inf 45.5%
associate-*r/45.5%
neg-mul-145.5%
distribute-rgt-neg-out45.5%
associate-*r/54.2%
Simplified54.2%
*-commutative54.2%
div-inv54.2%
associate-*l*42.6%
associate-/r/41.9%
clear-num42.6%
distribute-lft-neg-in42.6%
distribute-rgt-neg-out42.6%
add-log-exp49.3%
*-un-lft-identity49.3%
log-prod49.3%
metadata-eval49.3%
add-log-exp42.6%
distribute-rgt-neg-out42.6%
distribute-lft-neg-in42.6%
clear-num41.9%
associate-/r/42.6%
associate-*l*54.2%
div-inv54.2%
clear-num54.1%
associate-*l/54.2%
*-un-lft-identity54.2%
add-sqr-sqrt28.6%
sqrt-unprod34.6%
sqr-neg34.6%
sqrt-unprod8.0%
add-sqr-sqrt14.9%
Applied egg-rr14.9%
+-lft-identity14.9%
Simplified14.9%
Final simplification41.0%
(FPCore (x y z t) :precision binary64 (+ t (* x (/ (- z t) y))))
double code(double x, double y, double z, double t) {
return t + (x * ((z - t) / 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 + (x * ((z - t) / y))
end function
public static double code(double x, double y, double z, double t) {
return t + (x * ((z - t) / y));
}
def code(x, y, z, t): return t + (x * ((z - t) / y))
function code(x, y, z, t) return Float64(t + Float64(x * Float64(Float64(z - t) / y))) end
function tmp = code(x, y, z, t) tmp = t + (x * ((z - t) / y)); end
code[x_, y_, z_, t_] := N[(t + N[(x * N[(N[(z - t), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
t + x \cdot \frac{z - t}{y}
\end{array}
Initial program 97.7%
Taylor expanded in x around 0 92.5%
associate-*r/94.7%
Simplified94.7%
Final simplification94.7%
(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.7%
Taylor expanded in z around 0 60.0%
mul-1-neg60.0%
unsub-neg60.0%
associate-*r/67.3%
Simplified67.3%
Taylor expanded in t around 0 67.3%
Final simplification67.3%
(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.7%
Taylor expanded in x around 0 38.3%
Final simplification38.3%
(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 2023290
(FPCore (x y z t)
:name "Numeric.Signal.Multichannel:$cget from hsignal-0.2.7.1"
:precision binary64
:herbie-target
(if (< z 2.759456554562692e-282) (+ (* (/ x y) (- z t)) t) (if (< z 2.326994450874436e-110) (+ (* x (/ (- z t) y)) t) (+ (* (/ x y) (- z t)) t)))
(+ (* (/ x y) (- z t)) t))