
(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.0%
Final simplification97.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (/ x y) (- t))))
(if (<= (/ x y) -1e+20)
t_1
(if (<= (/ x y) 1e-7)
t
(if (or (<= (/ x y) 2e+114) (not (<= (/ x y) 2e+193)))
(* (/ x y) z)
t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = (x / y) * -t;
double tmp;
if ((x / y) <= -1e+20) {
tmp = t_1;
} else if ((x / y) <= 1e-7) {
tmp = t;
} else if (((x / y) <= 2e+114) || !((x / y) <= 2e+193)) {
tmp = (x / y) * z;
} 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) * -t
if ((x / y) <= (-1d+20)) then
tmp = t_1
else if ((x / y) <= 1d-7) then
tmp = t
else if (((x / y) <= 2d+114) .or. (.not. ((x / y) <= 2d+193))) then
tmp = (x / y) * z
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) * -t;
double tmp;
if ((x / y) <= -1e+20) {
tmp = t_1;
} else if ((x / y) <= 1e-7) {
tmp = t;
} else if (((x / y) <= 2e+114) || !((x / y) <= 2e+193)) {
tmp = (x / y) * z;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x / y) * -t tmp = 0 if (x / y) <= -1e+20: tmp = t_1 elif (x / y) <= 1e-7: tmp = t elif ((x / y) <= 2e+114) or not ((x / y) <= 2e+193): tmp = (x / y) * z else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x / y) * Float64(-t)) tmp = 0.0 if (Float64(x / y) <= -1e+20) tmp = t_1; elseif (Float64(x / y) <= 1e-7) tmp = t; elseif ((Float64(x / y) <= 2e+114) || !(Float64(x / y) <= 2e+193)) tmp = Float64(Float64(x / y) * z); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x / y) * -t; tmp = 0.0; if ((x / y) <= -1e+20) tmp = t_1; elseif ((x / y) <= 1e-7) tmp = t; elseif (((x / y) <= 2e+114) || ~(((x / y) <= 2e+193))) tmp = (x / y) * z; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x / y), $MachinePrecision] * (-t)), $MachinePrecision]}, If[LessEqual[N[(x / y), $MachinePrecision], -1e+20], t$95$1, If[LessEqual[N[(x / y), $MachinePrecision], 1e-7], t, If[Or[LessEqual[N[(x / y), $MachinePrecision], 2e+114], N[Not[LessEqual[N[(x / y), $MachinePrecision], 2e+193]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{y} \cdot \left(-t\right)\\
\mathbf{if}\;\frac{x}{y} \leq -1 \cdot 10^{+20}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{x}{y} \leq 10^{-7}:\\
\;\;\;\;t\\
\mathbf{elif}\;\frac{x}{y} \leq 2 \cdot 10^{+114} \lor \neg \left(\frac{x}{y} \leq 2 \cdot 10^{+193}\right):\\
\;\;\;\;\frac{x}{y} \cdot z\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if (/.f64 x y) < -1e20 or 2e114 < (/.f64 x y) < 2.00000000000000013e193Initial program 98.5%
Taylor expanded in x around 0 98.6%
Taylor expanded in x around -inf 98.6%
Taylor expanded in z around 0 63.9%
mul-1-neg63.9%
*-commutative63.9%
associate-*l/65.3%
distribute-rgt-neg-out65.3%
Simplified65.3%
if -1e20 < (/.f64 x y) < 9.9999999999999995e-8Initial program 97.9%
Taylor expanded in x around 0 77.6%
if 9.9999999999999995e-8 < (/.f64 x y) < 2e114 or 2.00000000000000013e193 < (/.f64 x y) Initial program 91.9%
Taylor expanded in x around 0 87.9%
Taylor expanded in x around -inf 87.6%
Taylor expanded in z around inf 57.0%
*-commutative57.0%
associate-/l*63.0%
Simplified63.0%
associate-/r/66.9%
Applied egg-rr66.9%
Final simplification72.3%
(FPCore (x y z t)
:precision binary64
(if (<= (/ x y) -1e+20)
(/ t (/ (- y) x))
(if (<= (/ x y) 1e-7)
t
(if (or (<= (/ x y) 2e+114) (not (<= (/ x y) 2e+193)))
(* (/ x y) z)
(* (/ x y) (- t))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -1e+20) {
tmp = t / (-y / x);
} else if ((x / y) <= 1e-7) {
tmp = t;
} else if (((x / y) <= 2e+114) || !((x / y) <= 2e+193)) {
tmp = (x / y) * z;
} 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) <= (-1d+20)) then
tmp = t / (-y / x)
else if ((x / y) <= 1d-7) then
tmp = t
else if (((x / y) <= 2d+114) .or. (.not. ((x / y) <= 2d+193))) then
tmp = (x / y) * z
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) <= -1e+20) {
tmp = t / (-y / x);
} else if ((x / y) <= 1e-7) {
tmp = t;
} else if (((x / y) <= 2e+114) || !((x / y) <= 2e+193)) {
tmp = (x / y) * z;
} else {
tmp = (x / y) * -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -1e+20: tmp = t / (-y / x) elif (x / y) <= 1e-7: tmp = t elif ((x / y) <= 2e+114) or not ((x / y) <= 2e+193): tmp = (x / y) * z else: tmp = (x / y) * -t return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -1e+20) tmp = Float64(t / Float64(Float64(-y) / x)); elseif (Float64(x / y) <= 1e-7) tmp = t; elseif ((Float64(x / y) <= 2e+114) || !(Float64(x / y) <= 2e+193)) tmp = Float64(Float64(x / y) * z); 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) <= -1e+20) tmp = t / (-y / x); elseif ((x / y) <= 1e-7) tmp = t; elseif (((x / y) <= 2e+114) || ~(((x / y) <= 2e+193))) tmp = (x / y) * z; else tmp = (x / y) * -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -1e+20], N[(t / N[((-y) / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 1e-7], t, If[Or[LessEqual[N[(x / y), $MachinePrecision], 2e+114], N[Not[LessEqual[N[(x / y), $MachinePrecision], 2e+193]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision], N[(N[(x / y), $MachinePrecision] * (-t)), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -1 \cdot 10^{+20}:\\
\;\;\;\;\frac{t}{\frac{-y}{x}}\\
\mathbf{elif}\;\frac{x}{y} \leq 10^{-7}:\\
\;\;\;\;t\\
\mathbf{elif}\;\frac{x}{y} \leq 2 \cdot 10^{+114} \lor \neg \left(\frac{x}{y} \leq 2 \cdot 10^{+193}\right):\\
\;\;\;\;\frac{x}{y} \cdot z\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} \cdot \left(-t\right)\\
\end{array}
\end{array}
if (/.f64 x y) < -1e20Initial program 98.1%
Taylor expanded in x around 0 98.2%
Taylor expanded in x around -inf 98.2%
Taylor expanded in z around 0 59.8%
mul-1-neg59.8%
*-commutative59.8%
associate-*l/63.2%
distribute-rgt-neg-out63.2%
Simplified63.2%
associate-*l/59.8%
distribute-rgt-neg-out59.8%
distribute-lft-neg-out59.8%
*-commutative59.8%
associate-/l*63.3%
frac-2neg63.3%
add-sqr-sqrt32.9%
sqrt-unprod27.9%
sqr-neg27.9%
sqrt-unprod4.4%
add-sqr-sqrt8.8%
add-sqr-sqrt6.2%
sqrt-unprod40.0%
sqr-neg40.0%
sqrt-unprod32.2%
add-sqr-sqrt63.3%
Applied egg-rr63.3%
if -1e20 < (/.f64 x y) < 9.9999999999999995e-8Initial program 97.9%
Taylor expanded in x around 0 77.6%
if 9.9999999999999995e-8 < (/.f64 x y) < 2e114 or 2.00000000000000013e193 < (/.f64 x y) Initial program 91.9%
Taylor expanded in x around 0 87.9%
Taylor expanded in x around -inf 87.6%
Taylor expanded in z around inf 57.0%
*-commutative57.0%
associate-/l*63.0%
Simplified63.0%
associate-/r/66.9%
Applied egg-rr66.9%
if 2e114 < (/.f64 x y) < 2.00000000000000013e193Initial program 99.9%
Taylor expanded in x around 0 99.9%
Taylor expanded in x around -inf 99.9%
Taylor expanded in z around 0 76.9%
mul-1-neg76.9%
*-commutative76.9%
associate-*l/71.7%
distribute-rgt-neg-out71.7%
Simplified71.7%
Final simplification72.3%
(FPCore (x y z t)
:precision binary64
(if (<= (/ x y) -1e+20)
(/ t (/ (- y) x))
(if (<= (/ x y) 1e-7)
t
(if (or (<= (/ x y) 2e+114) (not (<= (/ x y) 2e+193)))
(* (/ x y) z)
(/ (* t (- x)) y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -1e+20) {
tmp = t / (-y / x);
} else if ((x / y) <= 1e-7) {
tmp = t;
} else if (((x / y) <= 2e+114) || !((x / y) <= 2e+193)) {
tmp = (x / y) * z;
} else {
tmp = (t * -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 ((x / y) <= (-1d+20)) then
tmp = t / (-y / x)
else if ((x / y) <= 1d-7) then
tmp = t
else if (((x / y) <= 2d+114) .or. (.not. ((x / y) <= 2d+193))) then
tmp = (x / y) * z
else
tmp = (t * -x) / y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -1e+20) {
tmp = t / (-y / x);
} else if ((x / y) <= 1e-7) {
tmp = t;
} else if (((x / y) <= 2e+114) || !((x / y) <= 2e+193)) {
tmp = (x / y) * z;
} else {
tmp = (t * -x) / y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -1e+20: tmp = t / (-y / x) elif (x / y) <= 1e-7: tmp = t elif ((x / y) <= 2e+114) or not ((x / y) <= 2e+193): tmp = (x / y) * z else: tmp = (t * -x) / y return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -1e+20) tmp = Float64(t / Float64(Float64(-y) / x)); elseif (Float64(x / y) <= 1e-7) tmp = t; elseif ((Float64(x / y) <= 2e+114) || !(Float64(x / y) <= 2e+193)) tmp = Float64(Float64(x / y) * z); else tmp = Float64(Float64(t * Float64(-x)) / y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x / y) <= -1e+20) tmp = t / (-y / x); elseif ((x / y) <= 1e-7) tmp = t; elseif (((x / y) <= 2e+114) || ~(((x / y) <= 2e+193))) tmp = (x / y) * z; else tmp = (t * -x) / y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -1e+20], N[(t / N[((-y) / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 1e-7], t, If[Or[LessEqual[N[(x / y), $MachinePrecision], 2e+114], N[Not[LessEqual[N[(x / y), $MachinePrecision], 2e+193]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision], N[(N[(t * (-x)), $MachinePrecision] / y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -1 \cdot 10^{+20}:\\
\;\;\;\;\frac{t}{\frac{-y}{x}}\\
\mathbf{elif}\;\frac{x}{y} \leq 10^{-7}:\\
\;\;\;\;t\\
\mathbf{elif}\;\frac{x}{y} \leq 2 \cdot 10^{+114} \lor \neg \left(\frac{x}{y} \leq 2 \cdot 10^{+193}\right):\\
\;\;\;\;\frac{x}{y} \cdot z\\
\mathbf{else}:\\
\;\;\;\;\frac{t \cdot \left(-x\right)}{y}\\
\end{array}
\end{array}
if (/.f64 x y) < -1e20Initial program 98.1%
Taylor expanded in x around 0 98.2%
Taylor expanded in x around -inf 98.2%
Taylor expanded in z around 0 59.8%
mul-1-neg59.8%
*-commutative59.8%
associate-*l/63.2%
distribute-rgt-neg-out63.2%
Simplified63.2%
associate-*l/59.8%
distribute-rgt-neg-out59.8%
distribute-lft-neg-out59.8%
*-commutative59.8%
associate-/l*63.3%
frac-2neg63.3%
add-sqr-sqrt32.9%
sqrt-unprod27.9%
sqr-neg27.9%
sqrt-unprod4.4%
add-sqr-sqrt8.8%
add-sqr-sqrt6.2%
sqrt-unprod40.0%
sqr-neg40.0%
sqrt-unprod32.2%
add-sqr-sqrt63.3%
Applied egg-rr63.3%
if -1e20 < (/.f64 x y) < 9.9999999999999995e-8Initial program 97.9%
Taylor expanded in x around 0 77.6%
if 9.9999999999999995e-8 < (/.f64 x y) < 2e114 or 2.00000000000000013e193 < (/.f64 x y) Initial program 91.9%
Taylor expanded in x around 0 87.9%
Taylor expanded in x around -inf 87.6%
Taylor expanded in z around inf 57.0%
*-commutative57.0%
associate-/l*63.0%
Simplified63.0%
associate-/r/66.9%
Applied egg-rr66.9%
if 2e114 < (/.f64 x y) < 2.00000000000000013e193Initial program 99.9%
Taylor expanded in x around 0 99.9%
Taylor expanded in x around -inf 99.9%
Taylor expanded in z around 0 76.9%
neg-mul-176.9%
distribute-rgt-neg-in76.9%
Simplified76.9%
Final simplification72.6%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -1e+20) (not (<= (/ x y) 5e+18))) (/ (* x (- z t)) y) (+ t (* (/ x y) z))))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -1e+20) || !((x / y) <= 5e+18)) {
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) <= (-1d+20)) .or. (.not. ((x / y) <= 5d+18))) 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) <= -1e+20) || !((x / y) <= 5e+18)) {
tmp = (x * (z - t)) / y;
} else {
tmp = t + ((x / y) * z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -1e+20) or not ((x / y) <= 5e+18): 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) <= -1e+20) || !(Float64(x / y) <= 5e+18)) 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) <= -1e+20) || ~(((x / y) <= 5e+18))) 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], -1e+20], N[Not[LessEqual[N[(x / y), $MachinePrecision], 5e+18]], $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 -1 \cdot 10^{+20} \lor \neg \left(\frac{x}{y} \leq 5 \cdot 10^{+18}\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) < -1e20 or 5e18 < (/.f64 x y) Initial program 95.7%
Taylor expanded in x around 0 97.5%
Taylor expanded in x around -inf 97.5%
if -1e20 < (/.f64 x y) < 5e18Initial program 98.0%
Taylor expanded in z around inf 94.1%
associate-*r/96.0%
Simplified96.0%
Final simplification96.6%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -6e-93) (not (<= (/ x y) 1e-7))) (* (/ x y) z) t))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -6e-93) || !((x / y) <= 1e-7)) {
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) <= (-6d-93)) .or. (.not. ((x / y) <= 1d-7))) 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) <= -6e-93) || !((x / y) <= 1e-7)) {
tmp = (x / y) * z;
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -6e-93) or not ((x / y) <= 1e-7): tmp = (x / y) * z else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -6e-93) || !(Float64(x / y) <= 1e-7)) 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) <= -6e-93) || ~(((x / y) <= 1e-7))) tmp = (x / y) * z; else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -6e-93], N[Not[LessEqual[N[(x / y), $MachinePrecision], 1e-7]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision], t]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -6 \cdot 10^{-93} \lor \neg \left(\frac{x}{y} \leq 10^{-7}\right):\\
\;\;\;\;\frac{x}{y} \cdot z\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if (/.f64 x y) < -6.0000000000000003e-93 or 9.9999999999999995e-8 < (/.f64 x y) Initial program 96.3%
Taylor expanded in x around 0 94.2%
Taylor expanded in x around -inf 90.5%
Taylor expanded in z around inf 52.3%
*-commutative52.3%
associate-/l*51.6%
Simplified51.6%
associate-/r/57.2%
Applied egg-rr57.2%
if -6.0000000000000003e-93 < (/.f64 x y) < 9.9999999999999995e-8Initial program 97.7%
Taylor expanded in x around 0 82.1%
Final simplification69.5%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.65e+131) (not (<= t 3.4e-46))) (- t (* (/ x y) t)) (+ t (/ z (/ y x)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.65e+131) || !(t <= 3.4e-46)) {
tmp = t - ((x / y) * t);
} else {
tmp = t + (z / (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 <= (-1.65d+131)) .or. (.not. (t <= 3.4d-46))) then
tmp = t - ((x / y) * t)
else
tmp = t + (z / (y / x))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.65e+131) || !(t <= 3.4e-46)) {
tmp = t - ((x / y) * t);
} else {
tmp = t + (z / (y / x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1.65e+131) or not (t <= 3.4e-46): tmp = t - ((x / y) * t) else: tmp = t + (z / (y / x)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1.65e+131) || !(t <= 3.4e-46)) tmp = Float64(t - Float64(Float64(x / y) * t)); else tmp = Float64(t + Float64(z / Float64(y / x))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -1.65e+131) || ~((t <= 3.4e-46))) tmp = t - ((x / y) * t); else tmp = t + (z / (y / x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.65e+131], N[Not[LessEqual[t, 3.4e-46]], $MachinePrecision]], N[(t - N[(N[(x / y), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], N[(t + N[(z / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.65 \cdot 10^{+131} \lor \neg \left(t \leq 3.4 \cdot 10^{-46}\right):\\
\;\;\;\;t - \frac{x}{y} \cdot t\\
\mathbf{else}:\\
\;\;\;\;t + \frac{z}{\frac{y}{x}}\\
\end{array}
\end{array}
if t < -1.6499999999999999e131 or 3.39999999999999996e-46 < t Initial program 100.0%
Taylor expanded in z around 0 89.1%
mul-1-neg89.1%
unsub-neg89.1%
associate-*r/92.9%
Simplified92.9%
if -1.6499999999999999e131 < t < 3.39999999999999996e-46Initial program 94.8%
Taylor expanded in z around inf 85.0%
associate-/l*87.1%
Simplified87.1%
Final simplification89.6%
(FPCore (x y z t) :precision binary64 (if (<= t -2.6e+130) (- t (/ t (/ y x))) (if (<= t 4.5e-46) (+ t (/ z (/ y x))) (- t (* (/ x y) t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -2.6e+130) {
tmp = t - (t / (y / x));
} else if (t <= 4.5e-46) {
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 (t <= (-2.6d+130)) then
tmp = t - (t / (y / x))
else if (t <= 4.5d-46) 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 (t <= -2.6e+130) {
tmp = t - (t / (y / x));
} else if (t <= 4.5e-46) {
tmp = t + (z / (y / x));
} else {
tmp = t - ((x / y) * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -2.6e+130: tmp = t - (t / (y / x)) elif t <= 4.5e-46: tmp = t + (z / (y / x)) else: tmp = t - ((x / y) * t) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -2.6e+130) tmp = Float64(t - Float64(t / Float64(y / x))); elseif (t <= 4.5e-46) 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 (t <= -2.6e+130) tmp = t - (t / (y / x)); elseif (t <= 4.5e-46) tmp = t + (z / (y / x)); else tmp = t - ((x / y) * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -2.6e+130], N[(t - N[(t / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 4.5e-46], 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}\;t \leq -2.6 \cdot 10^{+130}:\\
\;\;\;\;t - \frac{t}{\frac{y}{x}}\\
\mathbf{elif}\;t \leq 4.5 \cdot 10^{-46}:\\
\;\;\;\;t + \frac{z}{\frac{y}{x}}\\
\mathbf{else}:\\
\;\;\;\;t - \frac{x}{y} \cdot t\\
\end{array}
\end{array}
if t < -2.5999999999999998e130Initial program 100.0%
Taylor expanded in z around 0 97.5%
mul-1-neg97.5%
unsub-neg97.5%
associate-/l*100.0%
associate-/r/90.6%
Simplified90.6%
associate-*l/97.5%
associate-/l*100.0%
Applied egg-rr100.0%
if -2.5999999999999998e130 < t < 4.50000000000000001e-46Initial program 94.8%
Taylor expanded in z around inf 85.0%
associate-/l*87.1%
Simplified87.1%
if 4.50000000000000001e-46 < t Initial program 100.0%
Taylor expanded in z around 0 84.1%
mul-1-neg84.1%
unsub-neg84.1%
associate-*r/88.7%
Simplified88.7%
Final simplification89.6%
(FPCore (x y z t) :precision binary64 (if (<= t -3.6e+150) (/ (* t (- x)) y) (+ t (* (/ x y) z))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -3.6e+150) {
tmp = (t * -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 <= (-3.6d+150)) then
tmp = (t * -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 <= -3.6e+150) {
tmp = (t * -x) / y;
} else {
tmp = t + ((x / y) * z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -3.6e+150: tmp = (t * -x) / y else: tmp = t + ((x / y) * z) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -3.6e+150) tmp = Float64(Float64(t * 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 <= -3.6e+150) tmp = (t * -x) / y; else tmp = t + ((x / y) * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -3.6e+150], N[(N[(t * (-x)), $MachinePrecision] / y), $MachinePrecision], N[(t + N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.6 \cdot 10^{+150}:\\
\;\;\;\;\frac{t \cdot \left(-x\right)}{y}\\
\mathbf{else}:\\
\;\;\;\;t + \frac{x}{y} \cdot z\\
\end{array}
\end{array}
if t < -3.59999999999999986e150Initial program 100.0%
Taylor expanded in x around 0 100.0%
Taylor expanded in x around -inf 69.5%
Taylor expanded in z around 0 69.5%
neg-mul-169.5%
distribute-rgt-neg-in69.5%
Simplified69.5%
if -3.59999999999999986e150 < t Initial program 96.5%
Taylor expanded in z around inf 82.4%
associate-*r/84.0%
Simplified84.0%
Final simplification81.9%
(FPCore (x y z t) :precision binary64 (if (<= t -4.8e+150) (/ (* t (- x)) y) (+ t (/ z (/ y x)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -4.8e+150) {
tmp = (t * -x) / y;
} else {
tmp = t + (z / (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 <= (-4.8d+150)) then
tmp = (t * -x) / y
else
tmp = t + (z / (y / x))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -4.8e+150) {
tmp = (t * -x) / y;
} else {
tmp = t + (z / (y / x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -4.8e+150: tmp = (t * -x) / y else: tmp = t + (z / (y / x)) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -4.8e+150) tmp = Float64(Float64(t * Float64(-x)) / y); else tmp = Float64(t + Float64(z / Float64(y / x))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -4.8e+150) tmp = (t * -x) / y; else tmp = t + (z / (y / x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -4.8e+150], N[(N[(t * (-x)), $MachinePrecision] / y), $MachinePrecision], N[(t + N[(z / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.8 \cdot 10^{+150}:\\
\;\;\;\;\frac{t \cdot \left(-x\right)}{y}\\
\mathbf{else}:\\
\;\;\;\;t + \frac{z}{\frac{y}{x}}\\
\end{array}
\end{array}
if t < -4.80000000000000005e150Initial program 100.0%
Taylor expanded in x around 0 100.0%
Taylor expanded in x around -inf 69.5%
Taylor expanded in z around 0 69.5%
neg-mul-169.5%
distribute-rgt-neg-in69.5%
Simplified69.5%
if -4.80000000000000005e150 < t Initial program 96.5%
Taylor expanded in z around inf 82.4%
associate-/l*84.3%
Simplified84.3%
Final simplification82.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 97.0%
Taylor expanded in x around 0 43.5%
Final simplification43.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 2023173
(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))