
(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 8 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 98.1%
Final simplification98.1%
(FPCore (x y z t)
:precision binary64
(if (or (<= (/ x y) -1e+28)
(and (not (<= (/ x y) 2e+113)) (<= (/ x y) 5e+220)))
(* (/ x y) (- t))
(+ t (* (/ x y) z))))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -1e+28) || (!((x / y) <= 2e+113) && ((x / y) <= 5e+220))) {
tmp = (x / y) * -t;
} else {
tmp = t + ((x / y) * z);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (((x / y) <= (-1d+28)) .or. (.not. ((x / y) <= 2d+113)) .and. ((x / y) <= 5d+220)) then
tmp = (x / y) * -t
else
tmp = t + ((x / y) * z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -1e+28) || (!((x / y) <= 2e+113) && ((x / y) <= 5e+220))) {
tmp = (x / y) * -t;
} else {
tmp = t + ((x / y) * z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -1e+28) or (not ((x / y) <= 2e+113) and ((x / y) <= 5e+220)): tmp = (x / y) * -t else: tmp = t + ((x / y) * z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -1e+28) || (!(Float64(x / y) <= 2e+113) && (Float64(x / y) <= 5e+220))) tmp = Float64(Float64(x / y) * Float64(-t)); else tmp = Float64(t + Float64(Float64(x / y) * z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x / y) <= -1e+28) || (~(((x / y) <= 2e+113)) && ((x / y) <= 5e+220))) tmp = (x / y) * -t; else tmp = t + ((x / y) * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -1e+28], And[N[Not[LessEqual[N[(x / y), $MachinePrecision], 2e+113]], $MachinePrecision], LessEqual[N[(x / y), $MachinePrecision], 5e+220]]], N[(N[(x / y), $MachinePrecision] * (-t)), $MachinePrecision], N[(t + N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -1 \cdot 10^{+28} \lor \neg \left(\frac{x}{y} \leq 2 \cdot 10^{+113}\right) \land \frac{x}{y} \leq 5 \cdot 10^{+220}:\\
\;\;\;\;\frac{x}{y} \cdot \left(-t\right)\\
\mathbf{else}:\\
\;\;\;\;t + \frac{x}{y} \cdot z\\
\end{array}
\end{array}
if (/.f64 x y) < -9.99999999999999958e27 or 2e113 < (/.f64 x y) < 5.0000000000000002e220Initial program 96.9%
Taylor expanded in x around 0 95.8%
*-commutative95.8%
associate-*r/92.7%
Simplified92.7%
clear-num92.7%
associate-/r/92.8%
Applied egg-rr92.8%
Taylor expanded in t around -inf 62.4%
associate-*r*62.4%
neg-mul-162.4%
sub-neg62.4%
metadata-eval62.4%
Simplified62.4%
Taylor expanded in x around inf 62.4%
if -9.99999999999999958e27 < (/.f64 x y) < 2e113 or 5.0000000000000002e220 < (/.f64 x y) Initial program 98.7%
Taylor expanded in z around inf 79.7%
associate-*r/86.4%
Simplified86.4%
Final simplification77.8%
(FPCore (x y z t)
:precision binary64
(if (or (<= z -145.0)
(and (not (<= z 2.25e-153))
(or (<= z 7.4e+24) (not (<= z 1.42e+57)))))
(+ t (* (/ x y) z))
(- t (* (/ x y) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -145.0) || (!(z <= 2.25e-153) && ((z <= 7.4e+24) || !(z <= 1.42e+57)))) {
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 ((z <= (-145.0d0)) .or. (.not. (z <= 2.25d-153)) .and. (z <= 7.4d+24) .or. (.not. (z <= 1.42d+57))) 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 ((z <= -145.0) || (!(z <= 2.25e-153) && ((z <= 7.4e+24) || !(z <= 1.42e+57)))) {
tmp = t + ((x / y) * z);
} else {
tmp = t - ((x / y) * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -145.0) or (not (z <= 2.25e-153) and ((z <= 7.4e+24) or not (z <= 1.42e+57))): tmp = t + ((x / y) * z) else: tmp = t - ((x / y) * t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -145.0) || (!(z <= 2.25e-153) && ((z <= 7.4e+24) || !(z <= 1.42e+57)))) tmp = Float64(t + Float64(Float64(x / 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 ((z <= -145.0) || (~((z <= 2.25e-153)) && ((z <= 7.4e+24) || ~((z <= 1.42e+57))))) tmp = t + ((x / y) * z); else tmp = t - ((x / y) * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -145.0], And[N[Not[LessEqual[z, 2.25e-153]], $MachinePrecision], Or[LessEqual[z, 7.4e+24], N[Not[LessEqual[z, 1.42e+57]], $MachinePrecision]]]], N[(t + N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(t - N[(N[(x / y), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -145 \lor \neg \left(z \leq 2.25 \cdot 10^{-153}\right) \land \left(z \leq 7.4 \cdot 10^{+24} \lor \neg \left(z \leq 1.42 \cdot 10^{+57}\right)\right):\\
\;\;\;\;t + \frac{x}{y} \cdot z\\
\mathbf{else}:\\
\;\;\;\;t - \frac{x}{y} \cdot t\\
\end{array}
\end{array}
if z < -145 or 2.25e-153 < z < 7.39999999999999998e24 or 1.42e57 < z Initial program 98.7%
Taylor expanded in z around inf 80.5%
associate-*r/86.8%
Simplified86.8%
if -145 < z < 2.25e-153 or 7.39999999999999998e24 < z < 1.42e57Initial program 97.0%
Taylor expanded in z around 0 83.6%
mul-1-neg83.6%
unsub-neg83.6%
associate-*r/86.5%
Simplified86.5%
Final simplification86.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ t (* (/ x y) z))))
(if (<= z -130.0)
t_1
(if (<= z 2.25e-153)
(- t (/ t (/ y x)))
(if (or (<= z 6.5e+24) (not (<= z 6e+57))) t_1 (- t (* (/ x y) t)))))))
double code(double x, double y, double z, double t) {
double t_1 = t + ((x / y) * z);
double tmp;
if (z <= -130.0) {
tmp = t_1;
} else if (z <= 2.25e-153) {
tmp = t - (t / (y / x));
} else if ((z <= 6.5e+24) || !(z <= 6e+57)) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = t + ((x / y) * z)
if (z <= (-130.0d0)) then
tmp = t_1
else if (z <= 2.25d-153) then
tmp = t - (t / (y / x))
else if ((z <= 6.5d+24) .or. (.not. (z <= 6d+57))) then
tmp = t_1
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 t_1 = t + ((x / y) * z);
double tmp;
if (z <= -130.0) {
tmp = t_1;
} else if (z <= 2.25e-153) {
tmp = t - (t / (y / x));
} else if ((z <= 6.5e+24) || !(z <= 6e+57)) {
tmp = t_1;
} else {
tmp = t - ((x / y) * t);
}
return tmp;
}
def code(x, y, z, t): t_1 = t + ((x / y) * z) tmp = 0 if z <= -130.0: tmp = t_1 elif z <= 2.25e-153: tmp = t - (t / (y / x)) elif (z <= 6.5e+24) or not (z <= 6e+57): tmp = t_1 else: tmp = t - ((x / y) * t) return tmp
function code(x, y, z, t) t_1 = Float64(t + Float64(Float64(x / y) * z)) tmp = 0.0 if (z <= -130.0) tmp = t_1; elseif (z <= 2.25e-153) tmp = Float64(t - Float64(t / Float64(y / x))); elseif ((z <= 6.5e+24) || !(z <= 6e+57)) tmp = t_1; else tmp = Float64(t - Float64(Float64(x / y) * t)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = t + ((x / y) * z); tmp = 0.0; if (z <= -130.0) tmp = t_1; elseif (z <= 2.25e-153) tmp = t - (t / (y / x)); elseif ((z <= 6.5e+24) || ~((z <= 6e+57))) tmp = t_1; else tmp = t - ((x / y) * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t + N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -130.0], t$95$1, If[LessEqual[z, 2.25e-153], N[(t - N[(t / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, 6.5e+24], N[Not[LessEqual[z, 6e+57]], $MachinePrecision]], t$95$1, N[(t - N[(N[(x / y), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t + \frac{x}{y} \cdot z\\
\mathbf{if}\;z \leq -130:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 2.25 \cdot 10^{-153}:\\
\;\;\;\;t - \frac{t}{\frac{y}{x}}\\
\mathbf{elif}\;z \leq 6.5 \cdot 10^{+24} \lor \neg \left(z \leq 6 \cdot 10^{+57}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t - \frac{x}{y} \cdot t\\
\end{array}
\end{array}
if z < -130 or 2.25e-153 < z < 6.4999999999999996e24 or 5.9999999999999999e57 < z Initial program 98.7%
Taylor expanded in z around inf 80.5%
associate-*r/86.8%
Simplified86.8%
if -130 < z < 2.25e-153Initial program 96.8%
Taylor expanded in z around 0 82.4%
mul-1-neg82.4%
unsub-neg82.4%
associate-/l*85.5%
associate-/r/85.4%
Simplified85.4%
associate-/r/85.5%
Applied egg-rr85.5%
if 6.4999999999999996e24 < z < 5.9999999999999999e57Initial program 99.8%
Taylor expanded in z around 0 98.8%
mul-1-neg98.8%
unsub-neg98.8%
associate-*r/98.7%
Simplified98.7%
Final simplification86.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ t (* (/ x y) z))))
(if (<= z -95.0)
t_1
(if (<= z 2.25e-153)
(- t (/ t (/ y x)))
(if (or (<= z 8e+24) (not (<= z 7.4e+56))) t_1 (- t (/ (* x t) y)))))))
double code(double x, double y, double z, double t) {
double t_1 = t + ((x / y) * z);
double tmp;
if (z <= -95.0) {
tmp = t_1;
} else if (z <= 2.25e-153) {
tmp = t - (t / (y / x));
} else if ((z <= 8e+24) || !(z <= 7.4e+56)) {
tmp = t_1;
} else {
tmp = t - ((x * t) / 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) :: t_1
real(8) :: tmp
t_1 = t + ((x / y) * z)
if (z <= (-95.0d0)) then
tmp = t_1
else if (z <= 2.25d-153) then
tmp = t - (t / (y / x))
else if ((z <= 8d+24) .or. (.not. (z <= 7.4d+56))) then
tmp = t_1
else
tmp = t - ((x * t) / y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = t + ((x / y) * z);
double tmp;
if (z <= -95.0) {
tmp = t_1;
} else if (z <= 2.25e-153) {
tmp = t - (t / (y / x));
} else if ((z <= 8e+24) || !(z <= 7.4e+56)) {
tmp = t_1;
} else {
tmp = t - ((x * t) / y);
}
return tmp;
}
def code(x, y, z, t): t_1 = t + ((x / y) * z) tmp = 0 if z <= -95.0: tmp = t_1 elif z <= 2.25e-153: tmp = t - (t / (y / x)) elif (z <= 8e+24) or not (z <= 7.4e+56): tmp = t_1 else: tmp = t - ((x * t) / y) return tmp
function code(x, y, z, t) t_1 = Float64(t + Float64(Float64(x / y) * z)) tmp = 0.0 if (z <= -95.0) tmp = t_1; elseif (z <= 2.25e-153) tmp = Float64(t - Float64(t / Float64(y / x))); elseif ((z <= 8e+24) || !(z <= 7.4e+56)) tmp = t_1; else tmp = Float64(t - Float64(Float64(x * t) / y)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = t + ((x / y) * z); tmp = 0.0; if (z <= -95.0) tmp = t_1; elseif (z <= 2.25e-153) tmp = t - (t / (y / x)); elseif ((z <= 8e+24) || ~((z <= 7.4e+56))) tmp = t_1; else tmp = t - ((x * t) / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t + N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -95.0], t$95$1, If[LessEqual[z, 2.25e-153], N[(t - N[(t / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, 8e+24], N[Not[LessEqual[z, 7.4e+56]], $MachinePrecision]], t$95$1, N[(t - N[(N[(x * t), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t + \frac{x}{y} \cdot z\\
\mathbf{if}\;z \leq -95:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 2.25 \cdot 10^{-153}:\\
\;\;\;\;t - \frac{t}{\frac{y}{x}}\\
\mathbf{elif}\;z \leq 8 \cdot 10^{+24} \lor \neg \left(z \leq 7.4 \cdot 10^{+56}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t - \frac{x \cdot t}{y}\\
\end{array}
\end{array}
if z < -95 or 2.25e-153 < z < 7.9999999999999999e24 or 7.39999999999999994e56 < z Initial program 98.7%
Taylor expanded in z around inf 80.5%
associate-*r/86.8%
Simplified86.8%
if -95 < z < 2.25e-153Initial program 96.8%
Taylor expanded in z around 0 82.4%
mul-1-neg82.4%
unsub-neg82.4%
associate-/l*85.5%
associate-/r/85.4%
Simplified85.4%
associate-/r/85.5%
Applied egg-rr85.5%
if 7.9999999999999999e24 < z < 7.39999999999999994e56Initial program 99.8%
*-commutative99.8%
clear-num99.6%
un-div-inv99.8%
Applied egg-rr99.8%
Taylor expanded in z around 0 98.8%
mul-1-neg98.8%
associate-*r/98.7%
unsub-neg98.7%
associate-*r/98.8%
Simplified98.8%
Final simplification86.7%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -6.6e-12) (not (<= (/ x y) 5.2e-7))) (* (/ x y) (- t)) t))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -6.6e-12) || !((x / y) <= 5.2e-7)) {
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 (((x / y) <= (-6.6d-12)) .or. (.not. ((x / y) <= 5.2d-7))) 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 (((x / y) <= -6.6e-12) || !((x / y) <= 5.2e-7)) {
tmp = (x / y) * -t;
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -6.6e-12) or not ((x / y) <= 5.2e-7): tmp = (x / y) * -t else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -6.6e-12) || !(Float64(x / y) <= 5.2e-7)) tmp = Float64(Float64(x / y) * Float64(-t)); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x / y) <= -6.6e-12) || ~(((x / y) <= 5.2e-7))) tmp = (x / y) * -t; else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -6.6e-12], N[Not[LessEqual[N[(x / y), $MachinePrecision], 5.2e-7]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] * (-t)), $MachinePrecision], t]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -6.6 \cdot 10^{-12} \lor \neg \left(\frac{x}{y} \leq 5.2 \cdot 10^{-7}\right):\\
\;\;\;\;\frac{x}{y} \cdot \left(-t\right)\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if (/.f64 x y) < -6.6000000000000001e-12 or 5.19999999999999998e-7 < (/.f64 x y) Initial program 98.0%
Taylor expanded in x around 0 91.3%
*-commutative91.3%
associate-*r/91.9%
Simplified91.9%
clear-num91.8%
associate-/r/91.8%
Applied egg-rr91.8%
Taylor expanded in t around -inf 54.0%
associate-*r*54.0%
neg-mul-154.0%
sub-neg54.0%
metadata-eval54.0%
Simplified54.0%
Taylor expanded in x around inf 53.6%
if -6.6000000000000001e-12 < (/.f64 x y) < 5.19999999999999998e-7Initial program 98.2%
Taylor expanded in x around 0 74.8%
Final simplification62.3%
(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 98.1%
Taylor expanded in x around 0 90.9%
*-commutative90.9%
associate-*r/92.2%
Simplified92.2%
Final simplification92.2%
(FPCore (x y z t) :precision binary64 t)
double code(double x, double y, double z, double t) {
return t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = t
end function
public static double code(double x, double y, double z, double t) {
return t;
}
def code(x, y, z, t): return t
function code(x, y, z, t) return t end
function tmp = code(x, y, z, t) tmp = t; end
code[x_, y_, z_, t_] := t
\begin{array}{l}
\\
t
\end{array}
Initial program 98.1%
Taylor expanded in x around 0 32.5%
Final simplification32.5%
(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 2023199
(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))