
(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 98.0%
Final simplification98.0%
(FPCore (x y z t)
:precision binary64
(if (<= (/ x y) -2e+253)
(+ t (/ x (/ y z)))
(if (or (<= (/ x y) -5e+18) (not (<= (/ x y) 2e+189)))
(* (/ x y) (- t))
(+ t (* (/ x y) z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -2e+253) {
tmp = t + (x / (y / z));
} else if (((x / y) <= -5e+18) || !((x / y) <= 2e+189)) {
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) <= (-2d+253)) then
tmp = t + (x / (y / z))
else if (((x / y) <= (-5d+18)) .or. (.not. ((x / y) <= 2d+189))) 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) <= -2e+253) {
tmp = t + (x / (y / z));
} else if (((x / y) <= -5e+18) || !((x / y) <= 2e+189)) {
tmp = (x / y) * -t;
} else {
tmp = t + ((x / y) * z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -2e+253: tmp = t + (x / (y / z)) elif ((x / y) <= -5e+18) or not ((x / y) <= 2e+189): 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) <= -2e+253) tmp = Float64(t + Float64(x / Float64(y / z))); elseif ((Float64(x / y) <= -5e+18) || !(Float64(x / y) <= 2e+189)) 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) <= -2e+253) tmp = t + (x / (y / z)); elseif (((x / y) <= -5e+18) || ~(((x / y) <= 2e+189))) tmp = (x / y) * -t; else tmp = t + ((x / y) * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -2e+253], N[(t + N[(x / N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[N[(x / y), $MachinePrecision], -5e+18], N[Not[LessEqual[N[(x / y), $MachinePrecision], 2e+189]], $MachinePrecision]], 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 -2 \cdot 10^{+253}:\\
\;\;\;\;t + \frac{x}{\frac{y}{z}}\\
\mathbf{elif}\;\frac{x}{y} \leq -5 \cdot 10^{+18} \lor \neg \left(\frac{x}{y} \leq 2 \cdot 10^{+189}\right):\\
\;\;\;\;\frac{x}{y} \cdot \left(-t\right)\\
\mathbf{else}:\\
\;\;\;\;t + \frac{x}{y} \cdot z\\
\end{array}
\end{array}
if (/.f64 x y) < -1.9999999999999999e253Initial program 90.1%
associate-*l/99.9%
associate-/l*99.9%
Applied egg-rr99.9%
Taylor expanded in z around inf 76.0%
if -1.9999999999999999e253 < (/.f64 x y) < -5e18 or 2e189 < (/.f64 x y) Initial program 99.8%
Taylor expanded in z around 0 67.2%
mul-1-neg67.2%
unsub-neg67.2%
associate-*r/72.3%
Simplified72.3%
Taylor expanded in x around inf 67.2%
associate-*r/67.2%
*-commutative67.2%
neg-mul-167.2%
distribute-rgt-neg-out67.2%
associate-*l/72.3%
Simplified72.3%
if -5e18 < (/.f64 x y) < 2e189Initial program 98.7%
Taylor expanded in z around inf 89.1%
associate-*r/90.7%
Simplified90.7%
Final simplification85.2%
(FPCore (x y z t)
:precision binary64
(if (or (<= (/ x y) -2e+253)
(and (not (<= (/ x y) -5e+18)) (<= (/ x y) 2e+189)))
(+ t (/ z (/ y x)))
(* (/ x y) (- t))))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -2e+253) || (!((x / y) <= -5e+18) && ((x / y) <= 2e+189))) {
tmp = t + (z / (y / x));
} 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) <= (-2d+253)) .or. (.not. ((x / y) <= (-5d+18))) .and. ((x / y) <= 2d+189)) then
tmp = t + (z / (y / x))
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) <= -2e+253) || (!((x / y) <= -5e+18) && ((x / y) <= 2e+189))) {
tmp = t + (z / (y / x));
} else {
tmp = (x / y) * -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -2e+253) or (not ((x / y) <= -5e+18) and ((x / y) <= 2e+189)): tmp = t + (z / (y / x)) else: tmp = (x / y) * -t return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -2e+253) || (!(Float64(x / y) <= -5e+18) && (Float64(x / y) <= 2e+189))) tmp = Float64(t + Float64(z / Float64(y / x))); else tmp = Float64(Float64(x / y) * Float64(-t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x / y) <= -2e+253) || (~(((x / y) <= -5e+18)) && ((x / y) <= 2e+189))) tmp = t + (z / (y / x)); else tmp = (x / y) * -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -2e+253], And[N[Not[LessEqual[N[(x / y), $MachinePrecision], -5e+18]], $MachinePrecision], LessEqual[N[(x / y), $MachinePrecision], 2e+189]]], N[(t + N[(z / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] * (-t)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -2 \cdot 10^{+253} \lor \neg \left(\frac{x}{y} \leq -5 \cdot 10^{+18}\right) \land \frac{x}{y} \leq 2 \cdot 10^{+189}:\\
\;\;\;\;t + \frac{z}{\frac{y}{x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} \cdot \left(-t\right)\\
\end{array}
\end{array}
if (/.f64 x y) < -1.9999999999999999e253 or -5e18 < (/.f64 x y) < 2e189Initial program 97.5%
Taylor expanded in z around inf 87.3%
associate-/l*88.9%
Simplified88.9%
if -1.9999999999999999e253 < (/.f64 x y) < -5e18 or 2e189 < (/.f64 x y) Initial program 99.8%
Taylor expanded in z around 0 67.2%
mul-1-neg67.2%
unsub-neg67.2%
associate-*r/72.3%
Simplified72.3%
Taylor expanded in x around inf 67.2%
associate-*r/67.2%
*-commutative67.2%
neg-mul-167.2%
distribute-rgt-neg-out67.2%
associate-*l/72.3%
Simplified72.3%
Final simplification85.4%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -5e+18) (not (<= (/ x y) 2e+189))) (* (/ x y) (- t)) (+ t (* (/ x y) z))))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -5e+18) || !((x / y) <= 2e+189)) {
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) <= (-5d+18)) .or. (.not. ((x / y) <= 2d+189))) 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) <= -5e+18) || !((x / y) <= 2e+189)) {
tmp = (x / y) * -t;
} else {
tmp = t + ((x / y) * z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -5e+18) or not ((x / y) <= 2e+189): 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) <= -5e+18) || !(Float64(x / y) <= 2e+189)) 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) <= -5e+18) || ~(((x / y) <= 2e+189))) 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], -5e+18], N[Not[LessEqual[N[(x / y), $MachinePrecision], 2e+189]], $MachinePrecision]], 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 -5 \cdot 10^{+18} \lor \neg \left(\frac{x}{y} \leq 2 \cdot 10^{+189}\right):\\
\;\;\;\;\frac{x}{y} \cdot \left(-t\right)\\
\mathbf{else}:\\
\;\;\;\;t + \frac{x}{y} \cdot z\\
\end{array}
\end{array}
if (/.f64 x y) < -5e18 or 2e189 < (/.f64 x y) Initial program 96.5%
Taylor expanded in z around 0 62.9%
mul-1-neg62.9%
unsub-neg62.9%
associate-*r/68.6%
Simplified68.6%
Taylor expanded in x around inf 62.9%
associate-*r/62.9%
*-commutative62.9%
neg-mul-162.9%
distribute-rgt-neg-out62.9%
associate-*l/68.6%
Simplified68.6%
if -5e18 < (/.f64 x y) < 2e189Initial program 98.7%
Taylor expanded in z around inf 89.1%
associate-*r/90.7%
Simplified90.7%
Final simplification83.6%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -1e+23) (not (<= (/ x y) 0.004))) (* (/ t y) (- x)) t))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -1e+23) || !((x / y) <= 0.004)) {
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) <= (-1d+23)) .or. (.not. ((x / y) <= 0.004d0))) 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) <= -1e+23) || !((x / y) <= 0.004)) {
tmp = (t / y) * -x;
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -1e+23) or not ((x / y) <= 0.004): tmp = (t / y) * -x else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -1e+23) || !(Float64(x / y) <= 0.004)) tmp = Float64(Float64(t / y) * Float64(-x)); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x / y) <= -1e+23) || ~(((x / y) <= 0.004))) tmp = (t / y) * -x; else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -1e+23], N[Not[LessEqual[N[(x / y), $MachinePrecision], 0.004]], $MachinePrecision]], N[(N[(t / y), $MachinePrecision] * (-x)), $MachinePrecision], t]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -1 \cdot 10^{+23} \lor \neg \left(\frac{x}{y} \leq 0.004\right):\\
\;\;\;\;\frac{t}{y} \cdot \left(-x\right)\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if (/.f64 x y) < -9.9999999999999992e22 or 0.0040000000000000001 < (/.f64 x y) Initial program 97.3%
Taylor expanded in z around 0 53.8%
mul-1-neg53.8%
unsub-neg53.8%
associate-*r/59.6%
Simplified59.6%
Taylor expanded in x around inf 53.4%
mul-1-neg53.4%
associate-*l/52.0%
*-commutative52.0%
distribute-rgt-neg-in52.0%
distribute-neg-frac52.0%
Simplified52.0%
if -9.9999999999999992e22 < (/.f64 x y) < 0.0040000000000000001Initial program 98.6%
Taylor expanded in x around 0 71.1%
Final simplification62.7%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -50000000.0) (not (<= (/ x y) 0.004))) (* (/ x y) (- t)) t))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -50000000.0) || !((x / y) <= 0.004)) {
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) <= (-50000000.0d0)) .or. (.not. ((x / y) <= 0.004d0))) 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) <= -50000000.0) || !((x / y) <= 0.004)) {
tmp = (x / y) * -t;
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -50000000.0) or not ((x / y) <= 0.004): tmp = (x / y) * -t else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -50000000.0) || !(Float64(x / y) <= 0.004)) 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) <= -50000000.0) || ~(((x / y) <= 0.004))) tmp = (x / y) * -t; else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -50000000.0], N[Not[LessEqual[N[(x / y), $MachinePrecision], 0.004]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] * (-t)), $MachinePrecision], t]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -50000000 \lor \neg \left(\frac{x}{y} \leq 0.004\right):\\
\;\;\;\;\frac{x}{y} \cdot \left(-t\right)\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if (/.f64 x y) < -5e7 or 0.0040000000000000001 < (/.f64 x y) Initial program 97.4%
Taylor expanded in z around 0 53.7%
mul-1-neg53.7%
unsub-neg53.7%
associate-*r/59.4%
Simplified59.4%
Taylor expanded in x around inf 53.2%
associate-*r/53.2%
*-commutative53.2%
neg-mul-153.2%
distribute-rgt-neg-out53.2%
associate-*l/58.9%
Simplified58.9%
if -5e7 < (/.f64 x y) < 0.0040000000000000001Initial program 98.5%
Taylor expanded in x around 0 72.9%
Final simplification66.5%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.4e+49) (not (<= t 1.55e-82))) (- t (* (/ x y) t)) (+ t (/ (* x z) y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.4e+49) || !(t <= 1.55e-82)) {
tmp = t - ((x / y) * t);
} 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.4d+49)) .or. (.not. (t <= 1.55d-82))) then
tmp = t - ((x / y) * t)
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.4e+49) || !(t <= 1.55e-82)) {
tmp = t - ((x / y) * t);
} else {
tmp = t + ((x * z) / y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1.4e+49) or not (t <= 1.55e-82): tmp = t - ((x / y) * t) else: tmp = t + ((x * z) / y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1.4e+49) || !(t <= 1.55e-82)) tmp = Float64(t - Float64(Float64(x / y) * t)); else tmp = Float64(t + Float64(Float64(x * z) / y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -1.4e+49) || ~((t <= 1.55e-82))) tmp = t - ((x / y) * t); else tmp = t + ((x * z) / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.4e+49], N[Not[LessEqual[t, 1.55e-82]], $MachinePrecision]], N[(t - N[(N[(x / y), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], N[(t + N[(N[(x * z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.4 \cdot 10^{+49} \lor \neg \left(t \leq 1.55 \cdot 10^{-82}\right):\\
\;\;\;\;t - \frac{x}{y} \cdot t\\
\mathbf{else}:\\
\;\;\;\;t + \frac{x \cdot z}{y}\\
\end{array}
\end{array}
if t < -1.3999999999999999e49 or 1.55e-82 < t Initial program 99.2%
Taylor expanded in z around 0 83.6%
mul-1-neg83.6%
unsub-neg83.6%
associate-*r/86.4%
Simplified86.4%
if -1.3999999999999999e49 < t < 1.55e-82Initial program 96.6%
Taylor expanded in z around inf 93.4%
Final simplification89.6%
(FPCore (x y z t) :precision binary64 (if (<= t -6.8e+50) (- t (* (/ x y) t)) (if (<= t 4.4e-82) (+ t (/ (* x z) y)) (- t (/ t (/ y x))))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -6.8e+50) {
tmp = t - ((x / y) * t);
} else if (t <= 4.4e-82) {
tmp = t + ((x * z) / 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 (t <= (-6.8d+50)) then
tmp = t - ((x / y) * t)
else if (t <= 4.4d-82) then
tmp = t + ((x * z) / 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 (t <= -6.8e+50) {
tmp = t - ((x / y) * t);
} else if (t <= 4.4e-82) {
tmp = t + ((x * z) / y);
} else {
tmp = t - (t / (y / x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -6.8e+50: tmp = t - ((x / y) * t) elif t <= 4.4e-82: tmp = t + ((x * z) / y) else: tmp = t - (t / (y / x)) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -6.8e+50) tmp = Float64(t - Float64(Float64(x / y) * t)); elseif (t <= 4.4e-82) tmp = Float64(t + Float64(Float64(x * z) / 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 (t <= -6.8e+50) tmp = t - ((x / y) * t); elseif (t <= 4.4e-82) tmp = t + ((x * z) / y); else tmp = t - (t / (y / x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -6.8e+50], N[(t - N[(N[(x / y), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 4.4e-82], N[(t + N[(N[(x * z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(t - N[(t / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -6.8 \cdot 10^{+50}:\\
\;\;\;\;t - \frac{x}{y} \cdot t\\
\mathbf{elif}\;t \leq 4.4 \cdot 10^{-82}:\\
\;\;\;\;t + \frac{x \cdot z}{y}\\
\mathbf{else}:\\
\;\;\;\;t - \frac{t}{\frac{y}{x}}\\
\end{array}
\end{array}
if t < -6.7999999999999997e50Initial program 99.9%
Taylor expanded in z around 0 84.0%
mul-1-neg84.0%
unsub-neg84.0%
associate-*r/87.5%
Simplified87.5%
if -6.7999999999999997e50 < t < 4.39999999999999971e-82Initial program 96.6%
Taylor expanded in z around inf 93.4%
if 4.39999999999999971e-82 < t Initial program 98.8%
Taylor expanded in z around 0 83.4%
mul-1-neg83.4%
associate-/l*85.8%
Simplified85.8%
Final simplification89.6%
(FPCore (x y z t) :precision binary64 (if (<= (/ x y) -9.5e+117) (* (/ x y) t) t))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -9.5e+117) {
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) <= (-9.5d+117)) 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) <= -9.5e+117) {
tmp = (x / y) * t;
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -9.5e+117: tmp = (x / y) * t else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -9.5e+117) tmp = Float64(Float64(x / y) * t); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x / y) <= -9.5e+117) tmp = (x / y) * t; else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -9.5e+117], N[(N[(x / y), $MachinePrecision] * t), $MachinePrecision], t]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -9.5 \cdot 10^{+117}:\\
\;\;\;\;\frac{x}{y} \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if (/.f64 x y) < -9.50000000000000041e117Initial program 93.3%
Taylor expanded in z around 0 56.4%
mul-1-neg56.4%
unsub-neg56.4%
associate-*r/60.9%
Simplified60.9%
Taylor expanded in x around inf 56.4%
mul-1-neg56.4%
associate-*l/56.4%
*-commutative56.4%
distribute-rgt-neg-in56.4%
distribute-neg-frac56.4%
Simplified56.4%
add-log-exp56.0%
associate-*r/56.0%
associate-*l/56.0%
*-un-lft-identity56.0%
log-prod56.0%
metadata-eval56.0%
add-log-exp60.9%
associate-*l/56.4%
associate-/l*56.4%
add-sqr-sqrt17.7%
sqrt-unprod20.8%
sqr-neg20.8%
sqrt-unprod3.2%
add-sqr-sqrt10.9%
Applied egg-rr10.9%
+-lft-identity10.9%
associate-/r/13.2%
Simplified13.2%
if -9.50000000000000041e117 < (/.f64 x y) Initial program 99.0%
Taylor expanded in x around 0 48.7%
Final simplification42.9%
(FPCore (x y z t) :precision binary64 (if (<= (/ x y) -5e+121) (/ t (/ y x)) t))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -5e+121) {
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) <= (-5d+121)) 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) <= -5e+121) {
tmp = t / (y / x);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -5e+121: tmp = t / (y / x) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -5e+121) tmp = 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) <= -5e+121) tmp = t / (y / x); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -5e+121], N[(t / N[(y / x), $MachinePrecision]), $MachinePrecision], t]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -5 \cdot 10^{+121}:\\
\;\;\;\;\frac{t}{\frac{y}{x}}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if (/.f64 x y) < -5.00000000000000007e121Initial program 93.3%
Taylor expanded in z around 0 56.4%
mul-1-neg56.4%
unsub-neg56.4%
associate-*r/60.9%
Simplified60.9%
Taylor expanded in x around inf 56.4%
mul-1-neg56.4%
associate-*l/56.4%
*-commutative56.4%
distribute-rgt-neg-in56.4%
distribute-neg-frac56.4%
Simplified56.4%
associate-*r/56.4%
associate-*l/60.9%
*-commutative60.9%
clear-num61.0%
un-div-inv61.0%
add-sqr-sqrt22.2%
sqrt-unprod22.9%
sqr-neg22.9%
sqrt-unprod3.3%
add-sqr-sqrt13.3%
Applied egg-rr13.3%
if -5.00000000000000007e121 < (/.f64 x y) Initial program 99.0%
Taylor expanded in x around 0 48.7%
Final simplification42.9%
(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.0%
Taylor expanded in x around 0 41.3%
Final simplification41.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 2023195
(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))