
(FPCore (x y z t) :precision binary64 (+ (* (/ x y) (- z t)) t))
double code(double x, double y, double z, double t) {
return ((x / y) * (z - t)) + t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((x / y) * (z - t)) + t
end function
public static double code(double x, double y, double z, double t) {
return ((x / y) * (z - t)) + t;
}
def code(x, y, z, t): return ((x / y) * (z - t)) + t
function code(x, y, z, t) return Float64(Float64(Float64(x / y) * Float64(z - t)) + t) end
function tmp = code(x, y, z, t) tmp = ((x / y) * (z - t)) + t; end
code[x_, y_, z_, t_] := N[(N[(N[(x / y), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{y} \cdot \left(z - t\right) + t
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ (* (/ x y) (- z t)) t))
double code(double x, double y, double z, double t) {
return ((x / y) * (z - t)) + t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((x / y) * (z - t)) + t
end function
public static double code(double x, double y, double z, double t) {
return ((x / y) * (z - t)) + t;
}
def code(x, y, z, t): return ((x / y) * (z - t)) + t
function code(x, y, z, t) return Float64(Float64(Float64(x / y) * Float64(z - t)) + t) end
function tmp = code(x, y, z, t) tmp = ((x / y) * (z - t)) + t; end
code[x_, y_, z_, t_] := N[(N[(N[(x / y), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{y} \cdot \left(z - t\right) + t
\end{array}
(FPCore (x y z t) :precision binary64 (+ t (* (/ 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.7%
Final simplification98.7%
(FPCore (x y z t)
:precision binary64
(if (<= (/ x y) -2e+44)
(* (/ x y) (- t))
(if (<= (/ x y) -5e-65)
(* (/ x y) z)
(if (<= (/ x y) 5e-19) t (/ (* x z) y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -2e+44) {
tmp = (x / y) * -t;
} else if ((x / y) <= -5e-65) {
tmp = (x / y) * z;
} else if ((x / y) <= 5e-19) {
tmp = t;
} else {
tmp = (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 ((x / y) <= (-2d+44)) then
tmp = (x / y) * -t
else if ((x / y) <= (-5d-65)) then
tmp = (x / y) * z
else if ((x / y) <= 5d-19) then
tmp = t
else
tmp = (x * z) / y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -2e+44) {
tmp = (x / y) * -t;
} else if ((x / y) <= -5e-65) {
tmp = (x / y) * z;
} else if ((x / y) <= 5e-19) {
tmp = t;
} else {
tmp = (x * z) / y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -2e+44: tmp = (x / y) * -t elif (x / y) <= -5e-65: tmp = (x / y) * z elif (x / y) <= 5e-19: tmp = t else: tmp = (x * z) / y return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -2e+44) tmp = Float64(Float64(x / y) * Float64(-t)); elseif (Float64(x / y) <= -5e-65) tmp = Float64(Float64(x / y) * z); elseif (Float64(x / y) <= 5e-19) tmp = t; else tmp = Float64(Float64(x * z) / y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x / y) <= -2e+44) tmp = (x / y) * -t; elseif ((x / y) <= -5e-65) tmp = (x / y) * z; elseif ((x / y) <= 5e-19) tmp = t; else tmp = (x * z) / y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -2e+44], N[(N[(x / y), $MachinePrecision] * (-t)), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], -5e-65], N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 5e-19], t, N[(N[(x * z), $MachinePrecision] / y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -2 \cdot 10^{+44}:\\
\;\;\;\;\frac{x}{y} \cdot \left(-t\right)\\
\mathbf{elif}\;\frac{x}{y} \leq -5 \cdot 10^{-65}:\\
\;\;\;\;\frac{x}{y} \cdot z\\
\mathbf{elif}\;\frac{x}{y} \leq 5 \cdot 10^{-19}:\\
\;\;\;\;t\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot z}{y}\\
\end{array}
\end{array}
if (/.f64 x y) < -2.0000000000000002e44Initial program 99.9%
Taylor expanded in z around 0 61.5%
*-rgt-identity61.5%
mul-1-neg61.5%
associate-/l*66.8%
distribute-rgt-neg-in66.8%
mul-1-neg66.8%
distribute-lft-in66.8%
mul-1-neg66.8%
unsub-neg66.8%
Simplified66.8%
Taylor expanded in x around inf 66.8%
associate-*r/66.8%
neg-mul-166.8%
Simplified66.8%
if -2.0000000000000002e44 < (/.f64 x y) < -4.99999999999999983e-65Initial program 99.9%
Taylor expanded in x around 0 80.3%
Taylor expanded in x around -inf 69.7%
Taylor expanded in z around inf 51.4%
*-commutative51.4%
associate-*r/67.1%
Simplified67.1%
if -4.99999999999999983e-65 < (/.f64 x y) < 5.0000000000000004e-19Initial program 98.2%
Taylor expanded in x around 0 79.2%
if 5.0000000000000004e-19 < (/.f64 x y) Initial program 98.3%
Taylor expanded in x around 0 98.2%
Taylor expanded in x around -inf 96.5%
Taylor expanded in z around inf 69.4%
Final simplification73.2%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -2e+44) (not (<= (/ x y) 4e+30))) (/ (* x (- z t)) y) (+ t (* (/ x y) z))))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -2e+44) || !((x / y) <= 4e+30)) {
tmp = (x * (z - t)) / 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 (((x / y) <= (-2d+44)) .or. (.not. ((x / y) <= 4d+30))) then
tmp = (x * (z - t)) / 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 (((x / y) <= -2e+44) || !((x / y) <= 4e+30)) {
tmp = (x * (z - t)) / y;
} else {
tmp = t + ((x / y) * z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -2e+44) or not ((x / y) <= 4e+30): tmp = (x * (z - t)) / y else: tmp = t + ((x / y) * z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -2e+44) || !(Float64(x / y) <= 4e+30)) tmp = Float64(Float64(x * Float64(z - t)) / y); 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+44) || ~(((x / y) <= 4e+30))) tmp = (x * (z - t)) / y; else tmp = t + ((x / y) * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -2e+44], N[Not[LessEqual[N[(x / y), $MachinePrecision], 4e+30]], $MachinePrecision]], N[(N[(x * N[(z - t), $MachinePrecision]), $MachinePrecision] / y), $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^{+44} \lor \neg \left(\frac{x}{y} \leq 4 \cdot 10^{+30}\right):\\
\;\;\;\;\frac{x \cdot \left(z - t\right)}{y}\\
\mathbf{else}:\\
\;\;\;\;t + \frac{x}{y} \cdot z\\
\end{array}
\end{array}
if (/.f64 x y) < -2.0000000000000002e44 or 4.0000000000000001e30 < (/.f64 x y) Initial program 99.0%
Taylor expanded in x around 0 98.1%
Taylor expanded in x around -inf 98.1%
if -2.0000000000000002e44 < (/.f64 x y) < 4.0000000000000001e30Initial program 98.5%
Taylor expanded in z around inf 94.9%
Final simplification96.3%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -5e-65) (not (<= (/ x y) 5e-19))) (* (/ x y) z) t))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -5e-65) || !((x / y) <= 5e-19)) {
tmp = (x / y) * z;
} 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-65)) .or. (.not. ((x / y) <= 5d-19))) then
tmp = (x / y) * z
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-65) || !((x / y) <= 5e-19)) {
tmp = (x / y) * z;
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -5e-65) or not ((x / y) <= 5e-19): tmp = (x / y) * z else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -5e-65) || !(Float64(x / y) <= 5e-19)) tmp = Float64(Float64(x / y) * z); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x / y) <= -5e-65) || ~(((x / y) <= 5e-19))) tmp = (x / y) * z; else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -5e-65], N[Not[LessEqual[N[(x / y), $MachinePrecision], 5e-19]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision], t]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -5 \cdot 10^{-65} \lor \neg \left(\frac{x}{y} \leq 5 \cdot 10^{-19}\right):\\
\;\;\;\;\frac{x}{y} \cdot z\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if (/.f64 x y) < -4.99999999999999983e-65 or 5.0000000000000004e-19 < (/.f64 x y) Initial program 99.2%
Taylor expanded in x around 0 95.1%
Taylor expanded in x around -inf 92.5%
Taylor expanded in z around inf 61.9%
*-commutative61.9%
associate-*r/64.3%
Simplified64.3%
if -4.99999999999999983e-65 < (/.f64 x y) < 5.0000000000000004e-19Initial program 98.2%
Taylor expanded in x around 0 79.2%
Final simplification71.2%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -5e-65) (not (<= (/ x y) 5e-19))) (* x (/ z y)) t))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -5e-65) || !((x / y) <= 5e-19)) {
tmp = x * (z / y);
} else {
tmp = t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (((x / y) <= (-5d-65)) .or. (.not. ((x / y) <= 5d-19))) then
tmp = x * (z / y)
else
tmp = t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -5e-65) || !((x / y) <= 5e-19)) {
tmp = x * (z / y);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -5e-65) or not ((x / y) <= 5e-19): tmp = x * (z / y) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -5e-65) || !(Float64(x / y) <= 5e-19)) tmp = Float64(x * Float64(z / y)); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x / y) <= -5e-65) || ~(((x / y) <= 5e-19))) tmp = x * (z / y); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -5e-65], N[Not[LessEqual[N[(x / y), $MachinePrecision], 5e-19]], $MachinePrecision]], N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision], t]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -5 \cdot 10^{-65} \lor \neg \left(\frac{x}{y} \leq 5 \cdot 10^{-19}\right):\\
\;\;\;\;x \cdot \frac{z}{y}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if (/.f64 x y) < -4.99999999999999983e-65 or 5.0000000000000004e-19 < (/.f64 x y) Initial program 99.2%
Taylor expanded in x around 0 95.1%
Taylor expanded in x around -inf 92.5%
Taylor expanded in z around inf 61.9%
associate-*r/60.3%
Simplified60.3%
if -4.99999999999999983e-65 < (/.f64 x y) < 5.0000000000000004e-19Initial program 98.2%
Taylor expanded in x around 0 79.2%
Final simplification69.0%
(FPCore (x y z t) :precision binary64 (if (<= (/ x y) -5e-65) (* (/ x y) z) (if (<= (/ x y) 5e-19) t (/ (* x z) y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -5e-65) {
tmp = (x / y) * z;
} else if ((x / y) <= 5e-19) {
tmp = t;
} else {
tmp = (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 ((x / y) <= (-5d-65)) then
tmp = (x / y) * z
else if ((x / y) <= 5d-19) then
tmp = t
else
tmp = (x * z) / y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -5e-65) {
tmp = (x / y) * z;
} else if ((x / y) <= 5e-19) {
tmp = t;
} else {
tmp = (x * z) / y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -5e-65: tmp = (x / y) * z elif (x / y) <= 5e-19: tmp = t else: tmp = (x * z) / y return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -5e-65) tmp = Float64(Float64(x / y) * z); elseif (Float64(x / y) <= 5e-19) tmp = t; else tmp = Float64(Float64(x * z) / y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x / y) <= -5e-65) tmp = (x / y) * z; elseif ((x / y) <= 5e-19) tmp = t; else tmp = (x * z) / y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -5e-65], N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 5e-19], t, N[(N[(x * z), $MachinePrecision] / y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -5 \cdot 10^{-65}:\\
\;\;\;\;\frac{x}{y} \cdot z\\
\mathbf{elif}\;\frac{x}{y} \leq 5 \cdot 10^{-19}:\\
\;\;\;\;t\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot z}{y}\\
\end{array}
\end{array}
if (/.f64 x y) < -4.99999999999999983e-65Initial program 99.9%
Taylor expanded in x around 0 92.6%
Taylor expanded in x around -inf 89.3%
Taylor expanded in z around inf 55.9%
*-commutative55.9%
associate-*r/60.8%
Simplified60.8%
if -4.99999999999999983e-65 < (/.f64 x y) < 5.0000000000000004e-19Initial program 98.2%
Taylor expanded in x around 0 79.2%
if 5.0000000000000004e-19 < (/.f64 x y) Initial program 98.3%
Taylor expanded in x around 0 98.2%
Taylor expanded in x around -inf 96.5%
Taylor expanded in z around inf 69.4%
Final simplification71.3%
(FPCore (x y z t) :precision binary64 (if (or (<= t -9e+40) (not (<= t 1.95e+135))) (* t (- 1.0 (/ x y))) (+ t (* (/ x y) z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -9e+40) || !(t <= 1.95e+135)) {
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 <= (-9d+40)) .or. (.not. (t <= 1.95d+135))) 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 <= -9e+40) || !(t <= 1.95e+135)) {
tmp = t * (1.0 - (x / y));
} else {
tmp = t + ((x / y) * z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -9e+40) or not (t <= 1.95e+135): 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 <= -9e+40) || !(t <= 1.95e+135)) tmp = Float64(t * Float64(1.0 - Float64(x / y))); 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 ((t <= -9e+40) || ~((t <= 1.95e+135))) 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, -9e+40], N[Not[LessEqual[t, 1.95e+135]], $MachinePrecision]], N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t + N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -9 \cdot 10^{+40} \lor \neg \left(t \leq 1.95 \cdot 10^{+135}\right):\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;t + \frac{x}{y} \cdot z\\
\end{array}
\end{array}
if t < -9.00000000000000064e40 or 1.95000000000000016e135 < t Initial program 100.0%
Taylor expanded in z around 0 89.7%
*-rgt-identity89.7%
mul-1-neg89.7%
associate-/l*95.1%
distribute-rgt-neg-in95.1%
mul-1-neg95.1%
distribute-lft-in95.1%
mul-1-neg95.1%
unsub-neg95.1%
Simplified95.1%
if -9.00000000000000064e40 < t < 1.95000000000000016e135Initial program 98.1%
Taylor expanded in z around inf 90.4%
Final simplification92.0%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.6e+43) (not (<= t 1.95e+135))) (* t (- 1.0 (/ x y))) (+ t (* x (/ z y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.6e+43) || !(t <= 1.95e+135)) {
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.6d+43)) .or. (.not. (t <= 1.95d+135))) 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.6e+43) || !(t <= 1.95e+135)) {
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.6e+43) or not (t <= 1.95e+135): 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.6e+43) || !(t <= 1.95e+135)) 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.6e+43) || ~((t <= 1.95e+135))) 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.6e+43], N[Not[LessEqual[t, 1.95e+135]], $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.6 \cdot 10^{+43} \lor \neg \left(t \leq 1.95 \cdot 10^{+135}\right):\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;t + x \cdot \frac{z}{y}\\
\end{array}
\end{array}
if t < -1.60000000000000007e43 or 1.95000000000000016e135 < t Initial program 100.0%
Taylor expanded in z around 0 89.7%
*-rgt-identity89.7%
mul-1-neg89.7%
associate-/l*95.1%
distribute-rgt-neg-in95.1%
mul-1-neg95.1%
distribute-lft-in95.1%
mul-1-neg95.1%
unsub-neg95.1%
Simplified95.1%
if -1.60000000000000007e43 < t < 1.95000000000000016e135Initial program 98.1%
Taylor expanded in z around inf 88.0%
associate-/l*87.3%
Simplified87.3%
Final simplification89.9%
(FPCore (x y z t) :precision binary64 (if (<= t -9e+42) (- t (* (/ x y) t)) (if (<= t 2.1e+135) (+ t (* (/ x y) z)) (* t (- 1.0 (/ x y))))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -9e+42) {
tmp = t - ((x / y) * t);
} else if (t <= 2.1e+135) {
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 (t <= (-9d+42)) then
tmp = t - ((x / y) * t)
else if (t <= 2.1d+135) 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 (t <= -9e+42) {
tmp = t - ((x / y) * t);
} else if (t <= 2.1e+135) {
tmp = t + ((x / y) * z);
} else {
tmp = t * (1.0 - (x / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -9e+42: tmp = t - ((x / y) * t) elif t <= 2.1e+135: tmp = t + ((x / y) * z) else: tmp = t * (1.0 - (x / y)) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -9e+42) tmp = Float64(t - Float64(Float64(x / y) * t)); elseif (t <= 2.1e+135) 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 (t <= -9e+42) tmp = t - ((x / y) * t); elseif (t <= 2.1e+135) tmp = t + ((x / y) * z); else tmp = t * (1.0 - (x / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -9e+42], N[(t - N[(N[(x / y), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.1e+135], 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}\;t \leq -9 \cdot 10^{+42}:\\
\;\;\;\;t - \frac{x}{y} \cdot t\\
\mathbf{elif}\;t \leq 2.1 \cdot 10^{+135}:\\
\;\;\;\;t + \frac{x}{y} \cdot z\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\
\end{array}
\end{array}
if t < -9.00000000000000025e42Initial program 99.9%
Taylor expanded in x around 0 96.1%
Taylor expanded in z around 0 87.6%
mul-1-neg87.6%
associate-*r/91.4%
distribute-lft-neg-in91.4%
cancel-sign-sub-inv91.4%
Simplified91.4%
if -9.00000000000000025e42 < t < 2.1000000000000001e135Initial program 98.1%
Taylor expanded in z around inf 90.4%
if 2.1000000000000001e135 < t Initial program 100.0%
Taylor expanded in z around 0 92.5%
*-rgt-identity92.5%
mul-1-neg92.5%
associate-/l*100.0%
distribute-rgt-neg-in100.0%
mul-1-neg100.0%
distribute-lft-in100.0%
mul-1-neg100.0%
unsub-neg100.0%
Simplified100.0%
Final simplification92.0%
(FPCore (x y z t) :precision binary64 (if (<= z -1.32e-41) (* (/ x y) z) (if (<= z 4.8e+144) (* t (- 1.0 (/ x y))) (/ (* x z) y))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.32e-41) {
tmp = (x / y) * z;
} else if (z <= 4.8e+144) {
tmp = t * (1.0 - (x / y));
} else {
tmp = (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 (z <= (-1.32d-41)) then
tmp = (x / y) * z
else if (z <= 4.8d+144) then
tmp = t * (1.0d0 - (x / y))
else
tmp = (x * z) / y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.32e-41) {
tmp = (x / y) * z;
} else if (z <= 4.8e+144) {
tmp = t * (1.0 - (x / y));
} else {
tmp = (x * z) / y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.32e-41: tmp = (x / y) * z elif z <= 4.8e+144: tmp = t * (1.0 - (x / y)) else: tmp = (x * z) / y return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.32e-41) tmp = Float64(Float64(x / y) * z); elseif (z <= 4.8e+144) tmp = Float64(t * Float64(1.0 - Float64(x / y))); else tmp = Float64(Float64(x * z) / y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.32e-41) tmp = (x / y) * z; elseif (z <= 4.8e+144) tmp = t * (1.0 - (x / y)); else tmp = (x * z) / y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.32e-41], N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision], If[LessEqual[z, 4.8e+144], N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * z), $MachinePrecision] / y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.32 \cdot 10^{-41}:\\
\;\;\;\;\frac{x}{y} \cdot z\\
\mathbf{elif}\;z \leq 4.8 \cdot 10^{+144}:\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot z}{y}\\
\end{array}
\end{array}
if z < -1.3200000000000001e-41Initial program 98.3%
Taylor expanded in x around 0 93.4%
Taylor expanded in x around -inf 73.6%
Taylor expanded in z around inf 70.1%
*-commutative70.1%
associate-*r/74.1%
Simplified74.1%
if -1.3200000000000001e-41 < z < 4.8000000000000001e144Initial program 99.3%
Taylor expanded in z around 0 78.6%
*-rgt-identity78.6%
mul-1-neg78.6%
associate-/l*81.7%
distribute-rgt-neg-in81.7%
mul-1-neg81.7%
distribute-lft-in81.7%
mul-1-neg81.7%
unsub-neg81.7%
Simplified81.7%
if 4.8000000000000001e144 < z Initial program 97.0%
Taylor expanded in x around 0 93.6%
Taylor expanded in x around -inf 77.1%
Taylor expanded in z around inf 73.8%
Final simplification78.6%
(FPCore (x y z t) :precision binary64 (if (<= (/ x y) 750000000.0) t (* (/ x y) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= 750000000.0) {
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) <= 750000000.0d0) 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) <= 750000000.0) {
tmp = t;
} else {
tmp = (x / y) * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= 750000000.0: tmp = t else: tmp = (x / y) * t return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= 750000000.0) 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) <= 750000000.0) tmp = t; else tmp = (x / y) * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], 750000000.0], t, N[(N[(x / y), $MachinePrecision] * t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq 750000000:\\
\;\;\;\;t\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} \cdot t\\
\end{array}
\end{array}
if (/.f64 x y) < 7.5e8Initial program 98.9%
Taylor expanded in x around 0 50.0%
if 7.5e8 < (/.f64 x y) Initial program 98.2%
Taylor expanded in z around 0 39.7%
*-rgt-identity39.7%
mul-1-neg39.7%
associate-/l*44.6%
distribute-rgt-neg-in44.6%
mul-1-neg44.6%
distribute-lft-in44.6%
mul-1-neg44.6%
unsub-neg44.6%
Simplified44.6%
Taylor expanded in x around inf 44.6%
associate-*r/44.6%
neg-mul-144.6%
Simplified44.6%
div-inv44.6%
add-sqr-sqrt20.8%
sqrt-unprod19.3%
sqr-neg19.3%
sqrt-unprod0.4%
add-sqr-sqrt9.0%
Applied egg-rr9.0%
associate-*r/9.0%
*-rgt-identity9.0%
Simplified9.0%
Final simplification41.0%
(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.7%
Taylor expanded in x around 0 39.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ (* (/ x y) (- z t)) t)))
(if (< z 2.759456554562692e-282)
t_1
(if (< z 2.326994450874436e-110) (+ (* x (/ (- z t) y)) t) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = ((x / y) * (z - t)) + t;
double tmp;
if (z < 2.759456554562692e-282) {
tmp = t_1;
} else if (z < 2.326994450874436e-110) {
tmp = (x * ((z - t) / y)) + t;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = ((x / y) * (z - t)) + t
if (z < 2.759456554562692d-282) then
tmp = t_1
else if (z < 2.326994450874436d-110) then
tmp = (x * ((z - t) / y)) + t
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = ((x / y) * (z - t)) + t;
double tmp;
if (z < 2.759456554562692e-282) {
tmp = t_1;
} else if (z < 2.326994450874436e-110) {
tmp = (x * ((z - t) / y)) + t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = ((x / y) * (z - t)) + t tmp = 0 if z < 2.759456554562692e-282: tmp = t_1 elif z < 2.326994450874436e-110: tmp = (x * ((z - t) / y)) + t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(Float64(x / y) * Float64(z - t)) + t) tmp = 0.0 if (z < 2.759456554562692e-282) tmp = t_1; elseif (z < 2.326994450874436e-110) tmp = Float64(Float64(x * Float64(Float64(z - t) / y)) + t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = ((x / y) * (z - t)) + t; tmp = 0.0; if (z < 2.759456554562692e-282) tmp = t_1; elseif (z < 2.326994450874436e-110) tmp = (x * ((z - t) / y)) + t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[(x / y), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]}, If[Less[z, 2.759456554562692e-282], t$95$1, If[Less[z, 2.326994450874436e-110], N[(N[(x * N[(N[(z - t), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{y} \cdot \left(z - t\right) + t\\
\mathbf{if}\;z < 2.759456554562692 \cdot 10^{-282}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z < 2.326994450874436 \cdot 10^{-110}:\\
\;\;\;\;x \cdot \frac{z - t}{y} + t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
herbie shell --seed 2024170
(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))