
(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 (fma (/ x y) (- z t) t))
double code(double x, double y, double z, double t) {
return fma((x / y), (z - t), t);
}
function code(x, y, z, t) return fma(Float64(x / y), Float64(z - t), t) end
code[x_, y_, z_, t_] := N[(N[(x / y), $MachinePrecision] * N[(z - t), $MachinePrecision] + t), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{x}{y}, z - t, t\right)
\end{array}
Initial program 97.1%
fma-define97.1%
Simplified97.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (/ x y) (- t))))
(if (<= x -225000000000.0)
t_1
(if (<= x 2.8e-114)
t
(if (or (<= x 4.5e+26) (not (<= x 5.8e+108))) (* x (/ z y)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = (x / y) * -t;
double tmp;
if (x <= -225000000000.0) {
tmp = t_1;
} else if (x <= 2.8e-114) {
tmp = t;
} else if ((x <= 4.5e+26) || !(x <= 5.8e+108)) {
tmp = x * (z / y);
} 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 <= (-225000000000.0d0)) then
tmp = t_1
else if (x <= 2.8d-114) then
tmp = t
else if ((x <= 4.5d+26) .or. (.not. (x <= 5.8d+108))) then
tmp = x * (z / y)
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 <= -225000000000.0) {
tmp = t_1;
} else if (x <= 2.8e-114) {
tmp = t;
} else if ((x <= 4.5e+26) || !(x <= 5.8e+108)) {
tmp = x * (z / y);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x / y) * -t tmp = 0 if x <= -225000000000.0: tmp = t_1 elif x <= 2.8e-114: tmp = t elif (x <= 4.5e+26) or not (x <= 5.8e+108): tmp = x * (z / y) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x / y) * Float64(-t)) tmp = 0.0 if (x <= -225000000000.0) tmp = t_1; elseif (x <= 2.8e-114) tmp = t; elseif ((x <= 4.5e+26) || !(x <= 5.8e+108)) tmp = Float64(x * Float64(z / y)); 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 <= -225000000000.0) tmp = t_1; elseif (x <= 2.8e-114) tmp = t; elseif ((x <= 4.5e+26) || ~((x <= 5.8e+108))) tmp = x * (z / y); 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[x, -225000000000.0], t$95$1, If[LessEqual[x, 2.8e-114], t, If[Or[LessEqual[x, 4.5e+26], N[Not[LessEqual[x, 5.8e+108]], $MachinePrecision]], N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{y} \cdot \left(-t\right)\\
\mathbf{if}\;x \leq -225000000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 2.8 \cdot 10^{-114}:\\
\;\;\;\;t\\
\mathbf{elif}\;x \leq 4.5 \cdot 10^{+26} \lor \neg \left(x \leq 5.8 \cdot 10^{+108}\right):\\
\;\;\;\;x \cdot \frac{z}{y}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -2.25e11 or 4.49999999999999978e26 < x < 5.80000000000000015e108Initial program 97.8%
Taylor expanded in z around 0 67.9%
mul-1-neg67.9%
*-commutative67.9%
associate-*l/74.9%
*-lft-identity74.9%
distribute-lft-neg-in74.9%
mul-1-neg74.9%
distribute-rgt-in75.0%
mul-1-neg75.0%
unsub-neg75.0%
Simplified75.0%
Taylor expanded in x around inf 58.6%
associate-*r/58.6%
neg-mul-158.6%
Simplified58.6%
if -2.25e11 < x < 2.8000000000000001e-114Initial program 99.4%
Taylor expanded in x around 0 65.8%
if 2.8000000000000001e-114 < x < 4.49999999999999978e26 or 5.80000000000000015e108 < x Initial program 93.2%
Taylor expanded in x around inf 94.7%
associate--l+94.7%
div-sub96.1%
Simplified96.1%
Taylor expanded in t around 0 58.8%
Final simplification61.3%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (/ t (- y)))))
(if (<= x -250000000.0)
t_1
(if (<= x 2.8e-114)
t
(if (or (<= x 2.55e+26) (not (<= x 3.8e+108))) (* x (/ z y)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = x * (t / -y);
double tmp;
if (x <= -250000000.0) {
tmp = t_1;
} else if (x <= 2.8e-114) {
tmp = t;
} else if ((x <= 2.55e+26) || !(x <= 3.8e+108)) {
tmp = x * (z / y);
} 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 * (t / -y)
if (x <= (-250000000.0d0)) then
tmp = t_1
else if (x <= 2.8d-114) then
tmp = t
else if ((x <= 2.55d+26) .or. (.not. (x <= 3.8d+108))) then
tmp = x * (z / y)
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 * (t / -y);
double tmp;
if (x <= -250000000.0) {
tmp = t_1;
} else if (x <= 2.8e-114) {
tmp = t;
} else if ((x <= 2.55e+26) || !(x <= 3.8e+108)) {
tmp = x * (z / y);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (t / -y) tmp = 0 if x <= -250000000.0: tmp = t_1 elif x <= 2.8e-114: tmp = t elif (x <= 2.55e+26) or not (x <= 3.8e+108): tmp = x * (z / y) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(t / Float64(-y))) tmp = 0.0 if (x <= -250000000.0) tmp = t_1; elseif (x <= 2.8e-114) tmp = t; elseif ((x <= 2.55e+26) || !(x <= 3.8e+108)) tmp = Float64(x * Float64(z / y)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (t / -y); tmp = 0.0; if (x <= -250000000.0) tmp = t_1; elseif (x <= 2.8e-114) tmp = t; elseif ((x <= 2.55e+26) || ~((x <= 3.8e+108))) tmp = x * (z / y); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(t / (-y)), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -250000000.0], t$95$1, If[LessEqual[x, 2.8e-114], t, If[Or[LessEqual[x, 2.55e+26], N[Not[LessEqual[x, 3.8e+108]], $MachinePrecision]], N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \frac{t}{-y}\\
\mathbf{if}\;x \leq -250000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 2.8 \cdot 10^{-114}:\\
\;\;\;\;t\\
\mathbf{elif}\;x \leq 2.55 \cdot 10^{+26} \lor \neg \left(x \leq 3.8 \cdot 10^{+108}\right):\\
\;\;\;\;x \cdot \frac{z}{y}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -2.5e8 or 2.5499999999999999e26 < x < 3.80000000000000008e108Initial program 97.8%
Taylor expanded in z around 0 67.9%
mul-1-neg67.9%
*-commutative67.9%
associate-*l/74.9%
*-lft-identity74.9%
distribute-lft-neg-in74.9%
mul-1-neg74.9%
distribute-rgt-in75.0%
mul-1-neg75.0%
unsub-neg75.0%
Simplified75.0%
Taylor expanded in x around inf 58.6%
associate-*r/58.6%
neg-mul-158.6%
Simplified58.6%
*-commutative58.6%
distribute-frac-neg58.6%
distribute-lft-neg-out58.6%
add-sqr-sqrt32.0%
sqrt-unprod32.3%
sqr-neg32.3%
sqrt-unprod2.4%
add-sqr-sqrt4.1%
associate-/r/2.0%
div-inv2.0%
clear-num2.0%
add-sqr-sqrt1.4%
sqrt-unprod32.3%
sqr-neg32.3%
sqrt-unprod32.0%
add-sqr-sqrt57.5%
Applied egg-rr57.5%
if -2.5e8 < x < 2.8000000000000001e-114Initial program 99.4%
Taylor expanded in x around 0 65.8%
if 2.8000000000000001e-114 < x < 2.5499999999999999e26 or 3.80000000000000008e108 < x Initial program 93.2%
Taylor expanded in x around inf 94.7%
associate--l+94.7%
div-sub96.1%
Simplified96.1%
Taylor expanded in t around 0 58.8%
Final simplification60.9%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -20000.0) (not (<= (/ x y) 0.4))) (* x (/ (- z t) y)) (+ t (* (/ x y) z))))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -20000.0) || !((x / y) <= 0.4)) {
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) <= (-20000.0d0)) .or. (.not. ((x / y) <= 0.4d0))) 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) <= -20000.0) || !((x / y) <= 0.4)) {
tmp = x * ((z - t) / y);
} else {
tmp = t + ((x / y) * z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -20000.0) or not ((x / y) <= 0.4): 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) <= -20000.0) || !(Float64(x / y) <= 0.4)) tmp = Float64(x * Float64(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) <= -20000.0) || ~(((x / y) <= 0.4))) 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], -20000.0], N[Not[LessEqual[N[(x / y), $MachinePrecision], 0.4]], $MachinePrecision]], N[(x * N[(N[(z - t), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(t + N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -20000 \lor \neg \left(\frac{x}{y} \leq 0.4\right):\\
\;\;\;\;x \cdot \frac{z - t}{y}\\
\mathbf{else}:\\
\;\;\;\;t + \frac{x}{y} \cdot z\\
\end{array}
\end{array}
if (/.f64 x y) < -2e4 or 0.40000000000000002 < (/.f64 x y) Initial program 95.1%
Taylor expanded in x around inf 94.5%
associate--l+94.5%
div-sub95.9%
Simplified95.9%
Taylor expanded in x around inf 93.2%
div-sub94.6%
Simplified94.6%
if -2e4 < (/.f64 x y) < 0.40000000000000002Initial program 99.5%
Taylor expanded in z around inf 97.3%
Final simplification95.9%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -20000.0) (not (<= (/ x y) 0.4))) (* x (/ (- z t) y)) (+ t (* x (/ z y)))))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -20000.0) || !((x / y) <= 0.4)) {
tmp = x * ((z - t) / 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 (((x / y) <= (-20000.0d0)) .or. (.not. ((x / y) <= 0.4d0))) then
tmp = x * ((z - t) / 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 (((x / y) <= -20000.0) || !((x / y) <= 0.4)) {
tmp = x * ((z - t) / y);
} else {
tmp = t + (x * (z / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -20000.0) or not ((x / y) <= 0.4): tmp = x * ((z - t) / y) else: tmp = t + (x * (z / y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -20000.0) || !(Float64(x / y) <= 0.4)) tmp = Float64(x * Float64(Float64(z - t) / 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 (((x / y) <= -20000.0) || ~(((x / y) <= 0.4))) tmp = x * ((z - t) / y); else tmp = t + (x * (z / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -20000.0], N[Not[LessEqual[N[(x / y), $MachinePrecision], 0.4]], $MachinePrecision]], N[(x * N[(N[(z - t), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(t + N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -20000 \lor \neg \left(\frac{x}{y} \leq 0.4\right):\\
\;\;\;\;x \cdot \frac{z - t}{y}\\
\mathbf{else}:\\
\;\;\;\;t + x \cdot \frac{z}{y}\\
\end{array}
\end{array}
if (/.f64 x y) < -2e4 or 0.40000000000000002 < (/.f64 x y) Initial program 95.1%
Taylor expanded in x around inf 94.5%
associate--l+94.5%
div-sub95.9%
Simplified95.9%
Taylor expanded in x around inf 93.2%
div-sub94.6%
Simplified94.6%
if -2e4 < (/.f64 x y) < 0.40000000000000002Initial program 99.5%
Taylor expanded in z around inf 94.5%
associate-/l*93.6%
Simplified93.6%
Final simplification94.2%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -1000000.0) (not (<= (/ x y) 0.4))) (* x (/ (- z t) y)) (* t (- 1.0 (/ x y)))))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -1000000.0) || !((x / y) <= 0.4)) {
tmp = x * ((z - t) / y);
} 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 (((x / y) <= (-1000000.0d0)) .or. (.not. ((x / y) <= 0.4d0))) then
tmp = x * ((z - t) / y)
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 (((x / y) <= -1000000.0) || !((x / y) <= 0.4)) {
tmp = x * ((z - t) / y);
} else {
tmp = t * (1.0 - (x / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -1000000.0) or not ((x / y) <= 0.4): tmp = x * ((z - t) / y) else: tmp = t * (1.0 - (x / y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -1000000.0) || !(Float64(x / y) <= 0.4)) tmp = Float64(x * Float64(Float64(z - t) / y)); 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 (((x / y) <= -1000000.0) || ~(((x / y) <= 0.4))) tmp = x * ((z - t) / y); else tmp = t * (1.0 - (x / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -1000000.0], N[Not[LessEqual[N[(x / y), $MachinePrecision], 0.4]], $MachinePrecision]], N[(x * N[(N[(z - t), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -1000000 \lor \neg \left(\frac{x}{y} \leq 0.4\right):\\
\;\;\;\;x \cdot \frac{z - t}{y}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\
\end{array}
\end{array}
if (/.f64 x y) < -1e6 or 0.40000000000000002 < (/.f64 x y) Initial program 95.1%
Taylor expanded in x around inf 95.1%
associate--l+95.1%
div-sub96.5%
Simplified96.5%
Taylor expanded in x around inf 94.2%
div-sub95.7%
Simplified95.7%
if -1e6 < (/.f64 x y) < 0.40000000000000002Initial program 99.5%
Taylor expanded in z around 0 70.7%
mul-1-neg70.7%
*-commutative70.7%
associate-*l/73.8%
*-lft-identity73.8%
distribute-lft-neg-in73.8%
mul-1-neg73.8%
distribute-rgt-in73.8%
mul-1-neg73.8%
unsub-neg73.8%
Simplified73.8%
Final simplification85.6%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.2e+162) (not (<= z 1.52e+124))) (* x (/ z y)) (* t (- 1.0 (/ x y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.2e+162) || !(z <= 1.52e+124)) {
tmp = x * (z / y);
} else {
tmp = t * (1.0 - (x / y));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-1.2d+162)) .or. (.not. (z <= 1.52d+124))) then
tmp = x * (z / y)
else
tmp = t * (1.0d0 - (x / y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.2e+162) || !(z <= 1.52e+124)) {
tmp = x * (z / y);
} else {
tmp = t * (1.0 - (x / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.2e+162) or not (z <= 1.52e+124): tmp = x * (z / y) else: tmp = t * (1.0 - (x / y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.2e+162) || !(z <= 1.52e+124)) tmp = Float64(x * Float64(z / y)); else tmp = Float64(t * Float64(1.0 - Float64(x / y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.2e+162) || ~((z <= 1.52e+124))) tmp = x * (z / y); else tmp = t * (1.0 - (x / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.2e+162], N[Not[LessEqual[z, 1.52e+124]], $MachinePrecision]], N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision], N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.2 \cdot 10^{+162} \lor \neg \left(z \leq 1.52 \cdot 10^{+124}\right):\\
\;\;\;\;x \cdot \frac{z}{y}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\
\end{array}
\end{array}
if z < -1.20000000000000005e162 or 1.51999999999999998e124 < z Initial program 99.0%
Taylor expanded in x around inf 82.1%
associate--l+82.1%
div-sub85.5%
Simplified85.5%
Taylor expanded in t around 0 80.2%
if -1.20000000000000005e162 < z < 1.51999999999999998e124Initial program 96.5%
Taylor expanded in z around 0 74.0%
mul-1-neg74.0%
*-commutative74.0%
associate-*l/77.8%
*-lft-identity77.8%
distribute-lft-neg-in77.8%
mul-1-neg77.8%
distribute-rgt-in77.8%
mul-1-neg77.8%
unsub-neg77.8%
Simplified77.8%
Final simplification78.3%
(FPCore (x y z t) :precision binary64 (if (or (<= t -2.4) (not (<= t 430000000.0))) (/ (* x t) x) (* x (/ z y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.4) || !(t <= 430000000.0)) {
tmp = (x * t) / x;
} 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 ((t <= (-2.4d0)) .or. (.not. (t <= 430000000.0d0))) then
tmp = (x * t) / x
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 ((t <= -2.4) || !(t <= 430000000.0)) {
tmp = (x * t) / x;
} else {
tmp = x * (z / y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -2.4) or not (t <= 430000000.0): tmp = (x * t) / x else: tmp = x * (z / y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -2.4) || !(t <= 430000000.0)) tmp = Float64(Float64(x * t) / x); else tmp = Float64(x * Float64(z / y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -2.4) || ~((t <= 430000000.0))) tmp = (x * t) / x; else tmp = x * (z / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -2.4], N[Not[LessEqual[t, 430000000.0]], $MachinePrecision]], N[(N[(x * t), $MachinePrecision] / x), $MachinePrecision], N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.4 \lor \neg \left(t \leq 430000000\right):\\
\;\;\;\;\frac{x \cdot t}{x}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{z}{y}\\
\end{array}
\end{array}
if t < -2.39999999999999991 or 4.3e8 < t Initial program 99.9%
Taylor expanded in x around inf 76.1%
associate--l+76.1%
div-sub77.6%
Simplified77.6%
Taylor expanded in x around 0 20.2%
associate-*r/50.3%
Applied egg-rr50.3%
if -2.39999999999999991 < t < 4.3e8Initial program 94.2%
Taylor expanded in x around inf 93.8%
associate--l+93.8%
div-sub93.8%
Simplified93.8%
Taylor expanded in t around 0 58.4%
Final simplification54.2%
(FPCore (x y z t) :precision binary64 (if (or (<= x -3100000000000.0) (not (<= x 2.7e-114))) (* x (/ z y)) t))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -3100000000000.0) || !(x <= 2.7e-114)) {
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 <= (-3100000000000.0d0)) .or. (.not. (x <= 2.7d-114))) 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 <= -3100000000000.0) || !(x <= 2.7e-114)) {
tmp = x * (z / y);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -3100000000000.0) or not (x <= 2.7e-114): tmp = x * (z / y) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -3100000000000.0) || !(x <= 2.7e-114)) 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 <= -3100000000000.0) || ~((x <= 2.7e-114))) tmp = x * (z / y); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -3100000000000.0], N[Not[LessEqual[x, 2.7e-114]], $MachinePrecision]], N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision], t]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3100000000000 \lor \neg \left(x \leq 2.7 \cdot 10^{-114}\right):\\
\;\;\;\;x \cdot \frac{z}{y}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if x < -3.1e12 or 2.7e-114 < x Initial program 95.7%
Taylor expanded in x around inf 97.5%
associate--l+97.5%
div-sub98.1%
Simplified98.1%
Taylor expanded in t around 0 46.9%
if -3.1e12 < x < 2.7e-114Initial program 99.4%
Taylor expanded in x around 0 65.1%
Final simplification53.7%
(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.1%
Final simplification97.1%
(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.1%
Taylor expanded in x around 0 34.1%
(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 2024172
(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))