
(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 (/ (- z t) (/ y x))))
double code(double x, double y, double z, double t) {
return t + ((z - t) / (y / x));
}
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 + ((z - t) / (y / x))
end function
public static double code(double x, double y, double z, double t) {
return t + ((z - t) / (y / x));
}
def code(x, y, z, t): return t + ((z - t) / (y / x))
function code(x, y, z, t) return Float64(t + Float64(Float64(z - t) / Float64(y / x))) end
function tmp = code(x, y, z, t) tmp = t + ((z - t) / (y / x)); end
code[x_, y_, z_, t_] := N[(t + N[(N[(z - t), $MachinePrecision] / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
t + \frac{z - t}{\frac{y}{x}}
\end{array}
Initial program 98.4%
Taylor expanded in x around 0 91.2%
associate-*r/89.7%
*-commutative89.7%
associate-/r/98.7%
Simplified98.7%
Final simplification98.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* t (- 1.0 (/ x y)))))
(if (<= t -6.1e+32)
t_1
(if (<= t -2.5e-12)
(/ (* z x) y)
(if (or (<= t -4e-88)
(and (not (<= t 9.6e-207))
(or (<= t 9.5e-150) (not (<= t 1.12e-74)))))
t_1
(* x (/ z y)))))))
double code(double x, double y, double z, double t) {
double t_1 = t * (1.0 - (x / y));
double tmp;
if (t <= -6.1e+32) {
tmp = t_1;
} else if (t <= -2.5e-12) {
tmp = (z * x) / y;
} else if ((t <= -4e-88) || (!(t <= 9.6e-207) && ((t <= 9.5e-150) || !(t <= 1.12e-74)))) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = t * (1.0d0 - (x / y))
if (t <= (-6.1d+32)) then
tmp = t_1
else if (t <= (-2.5d-12)) then
tmp = (z * x) / y
else if ((t <= (-4d-88)) .or. (.not. (t <= 9.6d-207)) .and. (t <= 9.5d-150) .or. (.not. (t <= 1.12d-74))) then
tmp = t_1
else
tmp = x * (z / y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = t * (1.0 - (x / y));
double tmp;
if (t <= -6.1e+32) {
tmp = t_1;
} else if (t <= -2.5e-12) {
tmp = (z * x) / y;
} else if ((t <= -4e-88) || (!(t <= 9.6e-207) && ((t <= 9.5e-150) || !(t <= 1.12e-74)))) {
tmp = t_1;
} else {
tmp = x * (z / y);
}
return tmp;
}
def code(x, y, z, t): t_1 = t * (1.0 - (x / y)) tmp = 0 if t <= -6.1e+32: tmp = t_1 elif t <= -2.5e-12: tmp = (z * x) / y elif (t <= -4e-88) or (not (t <= 9.6e-207) and ((t <= 9.5e-150) or not (t <= 1.12e-74))): tmp = t_1 else: tmp = x * (z / y) return tmp
function code(x, y, z, t) t_1 = Float64(t * Float64(1.0 - Float64(x / y))) tmp = 0.0 if (t <= -6.1e+32) tmp = t_1; elseif (t <= -2.5e-12) tmp = Float64(Float64(z * x) / y); elseif ((t <= -4e-88) || (!(t <= 9.6e-207) && ((t <= 9.5e-150) || !(t <= 1.12e-74)))) tmp = t_1; else tmp = Float64(x * Float64(z / y)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = t * (1.0 - (x / y)); tmp = 0.0; if (t <= -6.1e+32) tmp = t_1; elseif (t <= -2.5e-12) tmp = (z * x) / y; elseif ((t <= -4e-88) || (~((t <= 9.6e-207)) && ((t <= 9.5e-150) || ~((t <= 1.12e-74))))) tmp = t_1; else tmp = x * (z / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -6.1e+32], t$95$1, If[LessEqual[t, -2.5e-12], N[(N[(z * x), $MachinePrecision] / y), $MachinePrecision], If[Or[LessEqual[t, -4e-88], And[N[Not[LessEqual[t, 9.6e-207]], $MachinePrecision], Or[LessEqual[t, 9.5e-150], N[Not[LessEqual[t, 1.12e-74]], $MachinePrecision]]]], t$95$1, N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t \cdot \left(1 - \frac{x}{y}\right)\\
\mathbf{if}\;t \leq -6.1 \cdot 10^{+32}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -2.5 \cdot 10^{-12}:\\
\;\;\;\;\frac{z \cdot x}{y}\\
\mathbf{elif}\;t \leq -4 \cdot 10^{-88} \lor \neg \left(t \leq 9.6 \cdot 10^{-207}\right) \land \left(t \leq 9.5 \cdot 10^{-150} \lor \neg \left(t \leq 1.12 \cdot 10^{-74}\right)\right):\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{z}{y}\\
\end{array}
\end{array}
if t < -6.10000000000000027e32 or -2.49999999999999985e-12 < t < -3.99999999999999974e-88 or 9.59999999999999956e-207 < t < 9.50000000000000013e-150 or 1.11999999999999999e-74 < t Initial program 98.8%
Taylor expanded in z around 0 76.9%
mul-1-neg76.9%
*-lft-identity76.9%
*-commutative76.9%
associate-*l/83.3%
distribute-lft-neg-in83.3%
mul-1-neg83.3%
distribute-rgt-in83.3%
mul-1-neg83.3%
unsub-neg83.3%
Simplified83.3%
if -6.10000000000000027e32 < t < -2.49999999999999985e-12Initial program 100.0%
Taylor expanded in x around inf 84.5%
Taylor expanded in z around inf 100.0%
if -3.99999999999999974e-88 < t < 9.59999999999999956e-207 or 9.50000000000000013e-150 < t < 1.11999999999999999e-74Initial program 97.5%
Taylor expanded in x around inf 80.4%
Taylor expanded in z around inf 68.2%
associate-*r/71.6%
Simplified71.6%
Final simplification79.9%
(FPCore (x y z t)
:precision binary64
(if (<= (/ x y) -4e-27)
(* x (/ z y))
(if (<= (/ x y) 2e-24)
t
(if (<= (/ x y) 2e+70) (/ (* z x) y) (* (/ x y) (- t))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -4e-27) {
tmp = x * (z / y);
} else if ((x / y) <= 2e-24) {
tmp = t;
} else if ((x / y) <= 2e+70) {
tmp = (z * x) / y;
} 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) <= (-4d-27)) then
tmp = x * (z / y)
else if ((x / y) <= 2d-24) then
tmp = t
else if ((x / y) <= 2d+70) then
tmp = (z * x) / y
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) <= -4e-27) {
tmp = x * (z / y);
} else if ((x / y) <= 2e-24) {
tmp = t;
} else if ((x / y) <= 2e+70) {
tmp = (z * x) / y;
} else {
tmp = (x / y) * -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -4e-27: tmp = x * (z / y) elif (x / y) <= 2e-24: tmp = t elif (x / y) <= 2e+70: tmp = (z * x) / y else: tmp = (x / y) * -t return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -4e-27) tmp = Float64(x * Float64(z / y)); elseif (Float64(x / y) <= 2e-24) tmp = t; elseif (Float64(x / y) <= 2e+70) tmp = Float64(Float64(z * x) / y); 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) <= -4e-27) tmp = x * (z / y); elseif ((x / y) <= 2e-24) tmp = t; elseif ((x / y) <= 2e+70) tmp = (z * x) / y; else tmp = (x / y) * -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -4e-27], N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 2e-24], t, If[LessEqual[N[(x / y), $MachinePrecision], 2e+70], N[(N[(z * x), $MachinePrecision] / y), $MachinePrecision], N[(N[(x / y), $MachinePrecision] * (-t)), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -4 \cdot 10^{-27}:\\
\;\;\;\;x \cdot \frac{z}{y}\\
\mathbf{elif}\;\frac{x}{y} \leq 2 \cdot 10^{-24}:\\
\;\;\;\;t\\
\mathbf{elif}\;\frac{x}{y} \leq 2 \cdot 10^{+70}:\\
\;\;\;\;\frac{z \cdot x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} \cdot \left(-t\right)\\
\end{array}
\end{array}
if (/.f64 x y) < -4.0000000000000002e-27Initial program 95.8%
Taylor expanded in x around inf 83.1%
Taylor expanded in z around inf 55.1%
associate-*r/57.9%
Simplified57.9%
if -4.0000000000000002e-27 < (/.f64 x y) < 1.99999999999999985e-24Initial program 99.9%
Taylor expanded in x around 0 75.6%
if 1.99999999999999985e-24 < (/.f64 x y) < 2.00000000000000015e70Initial program 99.4%
Taylor expanded in x around inf 58.4%
Taylor expanded in z around inf 63.8%
if 2.00000000000000015e70 < (/.f64 x y) Initial program 98.2%
Taylor expanded in x around inf 89.5%
Taylor expanded in z around 0 54.6%
mul-1-neg54.6%
associate-*r/69.6%
Simplified69.6%
Final simplification68.9%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -5e+17) (not (<= (/ x y) 1e+20))) (* x (/ (- z t) y)) (+ t (/ z (/ y x)))))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -5e+17) || !((x / y) <= 1e+20)) {
tmp = x * ((z - t) / 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 (((x / y) <= (-5d+17)) .or. (.not. ((x / y) <= 1d+20))) then
tmp = x * ((z - t) / 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 (((x / y) <= -5e+17) || !((x / y) <= 1e+20)) {
tmp = x * ((z - t) / y);
} else {
tmp = t + (z / (y / x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -5e+17) or not ((x / y) <= 1e+20): tmp = x * ((z - t) / y) else: tmp = t + (z / (y / x)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -5e+17) || !(Float64(x / y) <= 1e+20)) tmp = Float64(x * Float64(Float64(z - t) / 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 (((x / y) <= -5e+17) || ~(((x / y) <= 1e+20))) tmp = x * ((z - t) / y); else tmp = t + (z / (y / x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -5e+17], N[Not[LessEqual[N[(x / y), $MachinePrecision], 1e+20]], $MachinePrecision]], N[(x * N[(N[(z - t), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(t + N[(z / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -5 \cdot 10^{+17} \lor \neg \left(\frac{x}{y} \leq 10^{+20}\right):\\
\;\;\;\;x \cdot \frac{z - t}{y}\\
\mathbf{else}:\\
\;\;\;\;t + \frac{z}{\frac{y}{x}}\\
\end{array}
\end{array}
if (/.f64 x y) < -5e17 or 1e20 < (/.f64 x y) Initial program 96.8%
Taylor expanded in x around inf 88.9%
Taylor expanded in z around 0 78.6%
associate-*r/80.9%
+-commutative80.9%
associate-*l/81.6%
associate-*r*81.6%
mul-1-neg81.6%
distribute-frac-neg81.6%
*-commutative81.6%
distribute-lft-out88.9%
distribute-frac-neg88.9%
sub-neg88.9%
div-sub93.8%
Simplified93.8%
if -5e17 < (/.f64 x y) < 1e20Initial program 99.8%
Taylor expanded in z around inf 90.8%
associate-/l*89.4%
Simplified89.4%
*-commutative89.4%
associate-/r/96.5%
Applied egg-rr96.5%
Final simplification95.2%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -5e+17) (not (<= (/ x y) 1e+20))) (* x (/ (- z t) y)) (+ t (* z (/ x y)))))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -5e+17) || !((x / y) <= 1e+20)) {
tmp = x * ((z - t) / y);
} else {
tmp = t + (z * (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) <= (-5d+17)) .or. (.not. ((x / y) <= 1d+20))) then
tmp = x * ((z - t) / y)
else
tmp = t + (z * (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) <= -5e+17) || !((x / y) <= 1e+20)) {
tmp = x * ((z - t) / y);
} else {
tmp = t + (z * (x / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -5e+17) or not ((x / y) <= 1e+20): tmp = x * ((z - t) / y) else: tmp = t + (z * (x / y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -5e+17) || !(Float64(x / y) <= 1e+20)) tmp = Float64(x * Float64(Float64(z - t) / y)); else tmp = Float64(t + Float64(z * Float64(x / y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x / y) <= -5e+17) || ~(((x / y) <= 1e+20))) tmp = x * ((z - t) / y); else tmp = t + (z * (x / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -5e+17], N[Not[LessEqual[N[(x / y), $MachinePrecision], 1e+20]], $MachinePrecision]], N[(x * N[(N[(z - t), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(t + N[(z * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -5 \cdot 10^{+17} \lor \neg \left(\frac{x}{y} \leq 10^{+20}\right):\\
\;\;\;\;x \cdot \frac{z - t}{y}\\
\mathbf{else}:\\
\;\;\;\;t + z \cdot \frac{x}{y}\\
\end{array}
\end{array}
if (/.f64 x y) < -5e17 or 1e20 < (/.f64 x y) Initial program 96.8%
Taylor expanded in x around inf 88.9%
Taylor expanded in z around 0 78.6%
associate-*r/80.9%
+-commutative80.9%
associate-*l/81.6%
associate-*r*81.6%
mul-1-neg81.6%
distribute-frac-neg81.6%
*-commutative81.6%
distribute-lft-out88.9%
distribute-frac-neg88.9%
sub-neg88.9%
div-sub93.8%
Simplified93.8%
if -5e17 < (/.f64 x y) < 1e20Initial program 99.8%
Taylor expanded in z around inf 96.5%
Final simplification95.2%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -500.0) (not (<= (/ x y) 4e-6))) (* x (/ (- z t) y)) (+ t (* x (/ z y)))))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -500.0) || !((x / y) <= 4e-6)) {
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) <= (-500.0d0)) .or. (.not. ((x / y) <= 4d-6))) 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) <= -500.0) || !((x / y) <= 4e-6)) {
tmp = x * ((z - t) / y);
} else {
tmp = t + (x * (z / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -500.0) or not ((x / y) <= 4e-6): 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) <= -500.0) || !(Float64(x / y) <= 4e-6)) 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) <= -500.0) || ~(((x / y) <= 4e-6))) 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], -500.0], N[Not[LessEqual[N[(x / y), $MachinePrecision], 4e-6]], $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 -500 \lor \neg \left(\frac{x}{y} \leq 4 \cdot 10^{-6}\right):\\
\;\;\;\;x \cdot \frac{z - t}{y}\\
\mathbf{else}:\\
\;\;\;\;t + x \cdot \frac{z}{y}\\
\end{array}
\end{array}
if (/.f64 x y) < -500 or 3.99999999999999982e-6 < (/.f64 x y) Initial program 97.0%
Taylor expanded in x around inf 84.8%
Taylor expanded in z around 0 78.5%
associate-*r/78.6%
+-commutative78.6%
associate-*l/78.0%
associate-*r*78.0%
mul-1-neg78.0%
distribute-frac-neg78.0%
*-commutative78.0%
distribute-lft-out84.8%
distribute-frac-neg84.8%
sub-neg84.8%
div-sub89.4%
Simplified89.4%
if -500 < (/.f64 x y) < 3.99999999999999982e-6Initial program 99.9%
Taylor expanded in z around inf 93.1%
associate-/l*93.8%
Simplified93.8%
Final simplification91.6%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -1000000.0) (not (<= (/ x y) 2e+26))) (* 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) <= 2e+26)) {
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) <= 2d+26))) 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) <= 2e+26)) {
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) <= 2e+26): 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) <= 2e+26)) 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) <= 2e+26))) 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], 2e+26]], $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 2 \cdot 10^{+26}\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 2.0000000000000001e26 < (/.f64 x y) Initial program 96.9%
Taylor expanded in x around inf 88.3%
Taylor expanded in z around 0 78.9%
associate-*r/80.5%
+-commutative80.5%
associate-*l/81.2%
associate-*r*81.2%
mul-1-neg81.2%
distribute-frac-neg81.2%
*-commutative81.2%
distribute-lft-out88.3%
distribute-frac-neg88.3%
sub-neg88.3%
div-sub93.2%
Simplified93.2%
if -1e6 < (/.f64 x y) < 2.0000000000000001e26Initial program 99.9%
Taylor expanded in z around 0 68.9%
mul-1-neg68.9%
*-lft-identity68.9%
*-commutative68.9%
associate-*l/73.6%
distribute-lft-neg-in73.6%
mul-1-neg73.6%
distribute-rgt-in73.6%
mul-1-neg73.6%
unsub-neg73.6%
Simplified73.6%
Final simplification83.3%
(FPCore (x y z t) :precision binary64 (if (<= (/ x y) -500.0) (/ (* (- z t) x) y) (if (<= (/ x y) 1e+20) (+ t (/ z (/ y x))) (* x (/ (- z t) y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -500.0) {
tmp = ((z - t) * x) / y;
} else if ((x / y) <= 1e+20) {
tmp = t + (z / (y / x));
} else {
tmp = x * ((z - t) / y);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x / y) <= (-500.0d0)) then
tmp = ((z - t) * x) / y
else if ((x / y) <= 1d+20) then
tmp = t + (z / (y / x))
else
tmp = x * ((z - t) / y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -500.0) {
tmp = ((z - t) * x) / y;
} else if ((x / y) <= 1e+20) {
tmp = t + (z / (y / x));
} else {
tmp = x * ((z - t) / y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -500.0: tmp = ((z - t) * x) / y elif (x / y) <= 1e+20: tmp = t + (z / (y / x)) else: tmp = x * ((z - t) / y) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -500.0) tmp = Float64(Float64(Float64(z - t) * x) / y); elseif (Float64(x / y) <= 1e+20) tmp = Float64(t + Float64(z / Float64(y / x))); else tmp = Float64(x * Float64(Float64(z - t) / y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x / y) <= -500.0) tmp = ((z - t) * x) / y; elseif ((x / y) <= 1e+20) tmp = t + (z / (y / x)); else tmp = x * ((z - t) / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -500.0], N[(N[(N[(z - t), $MachinePrecision] * x), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 1e+20], N[(t + N[(z / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(z - t), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -500:\\
\;\;\;\;\frac{\left(z - t\right) \cdot x}{y}\\
\mathbf{elif}\;\frac{x}{y} \leq 10^{+20}:\\
\;\;\;\;t + \frac{z}{\frac{y}{x}}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{z - t}{y}\\
\end{array}
\end{array}
if (/.f64 x y) < -500Initial program 95.6%
Taylor expanded in x around inf 84.1%
*-commutative84.1%
sub-div90.3%
associate-*l/92.1%
Applied egg-rr92.1%
if -500 < (/.f64 x y) < 1e20Initial program 99.9%
Taylor expanded in z around inf 92.5%
associate-/l*91.8%
Simplified91.8%
*-commutative91.8%
associate-/r/98.4%
Applied egg-rr98.4%
if 1e20 < (/.f64 x y) Initial program 98.3%
Taylor expanded in x around inf 89.3%
Taylor expanded in z around 0 79.8%
associate-*r/81.5%
+-commutative81.5%
associate-*l/84.5%
associate-*r*84.5%
mul-1-neg84.5%
distribute-frac-neg84.5%
*-commutative84.5%
distribute-lft-out89.3%
distribute-frac-neg89.3%
sub-neg89.3%
div-sub92.5%
Simplified92.5%
Final simplification95.3%
(FPCore (x y z t) :precision binary64 (if (<= y -8.6e+68) t (if (<= y 1.95e+57) (/ (* z x) y) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -8.6e+68) {
tmp = t;
} else if (y <= 1.95e+57) {
tmp = (z * x) / 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 (y <= (-8.6d+68)) then
tmp = t
else if (y <= 1.95d+57) then
tmp = (z * x) / 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 (y <= -8.6e+68) {
tmp = t;
} else if (y <= 1.95e+57) {
tmp = (z * x) / y;
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -8.6e+68: tmp = t elif y <= 1.95e+57: tmp = (z * x) / y else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -8.6e+68) tmp = t; elseif (y <= 1.95e+57) tmp = Float64(Float64(z * x) / y); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -8.6e+68) tmp = t; elseif (y <= 1.95e+57) tmp = (z * x) / y; else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -8.6e+68], t, If[LessEqual[y, 1.95e+57], N[(N[(z * x), $MachinePrecision] / y), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -8.6 \cdot 10^{+68}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 1.95 \cdot 10^{+57}:\\
\;\;\;\;\frac{z \cdot x}{y}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -8.6000000000000002e68 or 1.94999999999999984e57 < y Initial program 99.9%
Taylor expanded in x around 0 64.6%
if -8.6000000000000002e68 < y < 1.94999999999999984e57Initial program 97.4%
Taylor expanded in x around inf 68.8%
Taylor expanded in z around inf 52.4%
Final simplification57.2%
(FPCore (x y z t) :precision binary64 (if (<= t -1.8e+124) t (if (<= t 6.6e-57) (* x (/ z y)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.8e+124) {
tmp = t;
} else if (t <= 6.6e-57) {
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 (t <= (-1.8d+124)) then
tmp = t
else if (t <= 6.6d-57) 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 (t <= -1.8e+124) {
tmp = t;
} else if (t <= 6.6e-57) {
tmp = x * (z / y);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -1.8e+124: tmp = t elif t <= 6.6e-57: tmp = x * (z / y) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -1.8e+124) tmp = t; elseif (t <= 6.6e-57) 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 (t <= -1.8e+124) tmp = t; elseif (t <= 6.6e-57) tmp = x * (z / y); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -1.8e+124], t, If[LessEqual[t, 6.6e-57], N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.8 \cdot 10^{+124}:\\
\;\;\;\;t\\
\mathbf{elif}\;t \leq 6.6 \cdot 10^{-57}:\\
\;\;\;\;x \cdot \frac{z}{y}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if t < -1.79999999999999993e124 or 6.5999999999999997e-57 < t Initial program 99.9%
Taylor expanded in x around 0 53.5%
if -1.79999999999999993e124 < t < 6.5999999999999997e-57Initial program 97.1%
Taylor expanded in x around inf 68.0%
Taylor expanded in z around inf 60.0%
associate-*r/59.4%
Simplified59.4%
(FPCore (x y z t) :precision binary64 (+ t (* (- z t) (/ x y))))
double code(double x, double y, double z, double t) {
return t + ((z - t) * (x / y));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = t + ((z - t) * (x / y))
end function
public static double code(double x, double y, double z, double t) {
return t + ((z - t) * (x / y));
}
def code(x, y, z, t): return t + ((z - t) * (x / y))
function code(x, y, z, t) return Float64(t + Float64(Float64(z - t) * Float64(x / y))) end
function tmp = code(x, y, z, t) tmp = t + ((z - t) * (x / y)); end
code[x_, y_, z_, t_] := N[(t + N[(N[(z - t), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
t + \left(z - t\right) \cdot \frac{x}{y}
\end{array}
Initial program 98.4%
Final simplification98.4%
(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.4%
Taylor expanded in x around 0 36.8%
(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 2024110
(FPCore (x y z t)
:name "Numeric.Signal.Multichannel:$cget from hsignal-0.2.7.1"
:precision binary64
:alt
(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))