
(FPCore (x y z t a) :precision binary64 (- x (/ (- y z) (/ (+ (- t z) 1.0) a))))
double code(double x, double y, double z, double t, double a) {
return x - ((y - z) / (((t - z) + 1.0) / a));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x - ((y - z) / (((t - z) + 1.0d0) / a))
end function
public static double code(double x, double y, double z, double t, double a) {
return x - ((y - z) / (((t - z) + 1.0) / a));
}
def code(x, y, z, t, a): return x - ((y - z) / (((t - z) + 1.0) / a))
function code(x, y, z, t, a) return Float64(x - Float64(Float64(y - z) / Float64(Float64(Float64(t - z) + 1.0) / a))) end
function tmp = code(x, y, z, t, a) tmp = x - ((y - z) / (((t - z) + 1.0) / a)); end
code[x_, y_, z_, t_, a_] := N[(x - N[(N[(y - z), $MachinePrecision] / N[(N[(N[(t - z), $MachinePrecision] + 1.0), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{y - z}{\frac{\left(t - z\right) + 1}{a}}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (- x (/ (- y z) (/ (+ (- t z) 1.0) a))))
double code(double x, double y, double z, double t, double a) {
return x - ((y - z) / (((t - z) + 1.0) / a));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x - ((y - z) / (((t - z) + 1.0d0) / a))
end function
public static double code(double x, double y, double z, double t, double a) {
return x - ((y - z) / (((t - z) + 1.0) / a));
}
def code(x, y, z, t, a): return x - ((y - z) / (((t - z) + 1.0) / a))
function code(x, y, z, t, a) return Float64(x - Float64(Float64(y - z) / Float64(Float64(Float64(t - z) + 1.0) / a))) end
function tmp = code(x, y, z, t, a) tmp = x - ((y - z) / (((t - z) + 1.0) / a)); end
code[x_, y_, z_, t_, a_] := N[(x - N[(N[(y - z), $MachinePrecision] / N[(N[(N[(t - z), $MachinePrecision] + 1.0), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{y - z}{\frac{\left(t - z\right) + 1}{a}}
\end{array}
(FPCore (x y z t a) :precision binary64 (+ x (* a (/ (- z y) (+ (- t z) 1.0)))))
double code(double x, double y, double z, double t, double a) {
return x + (a * ((z - y) / ((t - z) + 1.0)));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + (a * ((z - y) / ((t - z) + 1.0d0)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (a * ((z - y) / ((t - z) + 1.0)));
}
def code(x, y, z, t, a): return x + (a * ((z - y) / ((t - z) + 1.0)))
function code(x, y, z, t, a) return Float64(x + Float64(a * Float64(Float64(z - y) / Float64(Float64(t - z) + 1.0)))) end
function tmp = code(x, y, z, t, a) tmp = x + (a * ((z - y) / ((t - z) + 1.0))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(a * N[(N[(z - y), $MachinePrecision] / N[(N[(t - z), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + a \cdot \frac{z - y}{\left(t - z\right) + 1}
\end{array}
Initial program 96.1%
associate-/r/99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- x (* y a))) (t_2 (- x (* (/ a t) (- y z)))))
(if (<= t -1.85e+18)
t_2
(if (<= t -1.8e-94)
(- x a)
(if (<= t -2.35e-142)
t_1
(if (<= t 7.6e-150)
(- x a)
(if (<= t 4e-70)
t_1
(if (<= t 0.0009) (+ x (/ (* z a) (- 1.0 z))) t_2))))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x - (y * a);
double t_2 = x - ((a / t) * (y - z));
double tmp;
if (t <= -1.85e+18) {
tmp = t_2;
} else if (t <= -1.8e-94) {
tmp = x - a;
} else if (t <= -2.35e-142) {
tmp = t_1;
} else if (t <= 7.6e-150) {
tmp = x - a;
} else if (t <= 4e-70) {
tmp = t_1;
} else if (t <= 0.0009) {
tmp = x + ((z * a) / (1.0 - z));
} else {
tmp = t_2;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = x - (y * a)
t_2 = x - ((a / t) * (y - z))
if (t <= (-1.85d+18)) then
tmp = t_2
else if (t <= (-1.8d-94)) then
tmp = x - a
else if (t <= (-2.35d-142)) then
tmp = t_1
else if (t <= 7.6d-150) then
tmp = x - a
else if (t <= 4d-70) then
tmp = t_1
else if (t <= 0.0009d0) then
tmp = x + ((z * a) / (1.0d0 - z))
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = x - (y * a);
double t_2 = x - ((a / t) * (y - z));
double tmp;
if (t <= -1.85e+18) {
tmp = t_2;
} else if (t <= -1.8e-94) {
tmp = x - a;
} else if (t <= -2.35e-142) {
tmp = t_1;
} else if (t <= 7.6e-150) {
tmp = x - a;
} else if (t <= 4e-70) {
tmp = t_1;
} else if (t <= 0.0009) {
tmp = x + ((z * a) / (1.0 - z));
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x - (y * a) t_2 = x - ((a / t) * (y - z)) tmp = 0 if t <= -1.85e+18: tmp = t_2 elif t <= -1.8e-94: tmp = x - a elif t <= -2.35e-142: tmp = t_1 elif t <= 7.6e-150: tmp = x - a elif t <= 4e-70: tmp = t_1 elif t <= 0.0009: tmp = x + ((z * a) / (1.0 - z)) else: tmp = t_2 return tmp
function code(x, y, z, t, a) t_1 = Float64(x - Float64(y * a)) t_2 = Float64(x - Float64(Float64(a / t) * Float64(y - z))) tmp = 0.0 if (t <= -1.85e+18) tmp = t_2; elseif (t <= -1.8e-94) tmp = Float64(x - a); elseif (t <= -2.35e-142) tmp = t_1; elseif (t <= 7.6e-150) tmp = Float64(x - a); elseif (t <= 4e-70) tmp = t_1; elseif (t <= 0.0009) tmp = Float64(x + Float64(Float64(z * a) / Float64(1.0 - z))); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x - (y * a); t_2 = x - ((a / t) * (y - z)); tmp = 0.0; if (t <= -1.85e+18) tmp = t_2; elseif (t <= -1.8e-94) tmp = x - a; elseif (t <= -2.35e-142) tmp = t_1; elseif (t <= 7.6e-150) tmp = x - a; elseif (t <= 4e-70) tmp = t_1; elseif (t <= 0.0009) tmp = x + ((z * a) / (1.0 - z)); else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x - N[(y * a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x - N[(N[(a / t), $MachinePrecision] * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -1.85e+18], t$95$2, If[LessEqual[t, -1.8e-94], N[(x - a), $MachinePrecision], If[LessEqual[t, -2.35e-142], t$95$1, If[LessEqual[t, 7.6e-150], N[(x - a), $MachinePrecision], If[LessEqual[t, 4e-70], t$95$1, If[LessEqual[t, 0.0009], N[(x + N[(N[(z * a), $MachinePrecision] / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$2]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x - y \cdot a\\
t_2 := x - \frac{a}{t} \cdot \left(y - z\right)\\
\mathbf{if}\;t \leq -1.85 \cdot 10^{+18}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t \leq -1.8 \cdot 10^{-94}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;t \leq -2.35 \cdot 10^{-142}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 7.6 \cdot 10^{-150}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;t \leq 4 \cdot 10^{-70}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 0.0009:\\
\;\;\;\;x + \frac{z \cdot a}{1 - z}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if t < -1.85e18 or 8.9999999999999998e-4 < t Initial program 95.5%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in t around inf 82.0%
associate-/l*89.3%
associate-/r/88.1%
Simplified88.1%
if -1.85e18 < t < -1.8e-94 or -2.34999999999999995e-142 < t < 7.5999999999999997e-150Initial program 97.7%
associate-/r/100.0%
Simplified100.0%
Taylor expanded in z around inf 71.5%
if -1.8e-94 < t < -2.34999999999999995e-142 or 7.5999999999999997e-150 < t < 3.99999999999999998e-70Initial program 94.5%
associate-/r/99.8%
Simplified99.8%
Taylor expanded in t around 0 99.8%
Taylor expanded in z around 0 73.6%
if 3.99999999999999998e-70 < t < 8.9999999999999998e-4Initial program 94.6%
associate-/r/100.0%
Simplified100.0%
Taylor expanded in t around 0 96.9%
Taylor expanded in y around 0 81.4%
cancel-sign-sub-inv81.4%
metadata-eval81.4%
*-lft-identity81.4%
Simplified81.4%
Final simplification79.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- x (* y a))) (t_2 (- x (* a (/ y t)))))
(if (<= t -2.4)
t_2
(if (<= t -3.6e-94)
(- x a)
(if (<= t -2e-143)
t_1
(if (<= t 5.2e-148)
(- x a)
(if (<= t 3.2e-64) t_1 (if (<= t 8.5e+33) (- x a) t_2))))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x - (y * a);
double t_2 = x - (a * (y / t));
double tmp;
if (t <= -2.4) {
tmp = t_2;
} else if (t <= -3.6e-94) {
tmp = x - a;
} else if (t <= -2e-143) {
tmp = t_1;
} else if (t <= 5.2e-148) {
tmp = x - a;
} else if (t <= 3.2e-64) {
tmp = t_1;
} else if (t <= 8.5e+33) {
tmp = x - a;
} else {
tmp = t_2;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = x - (y * a)
t_2 = x - (a * (y / t))
if (t <= (-2.4d0)) then
tmp = t_2
else if (t <= (-3.6d-94)) then
tmp = x - a
else if (t <= (-2d-143)) then
tmp = t_1
else if (t <= 5.2d-148) then
tmp = x - a
else if (t <= 3.2d-64) then
tmp = t_1
else if (t <= 8.5d+33) then
tmp = x - a
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = x - (y * a);
double t_2 = x - (a * (y / t));
double tmp;
if (t <= -2.4) {
tmp = t_2;
} else if (t <= -3.6e-94) {
tmp = x - a;
} else if (t <= -2e-143) {
tmp = t_1;
} else if (t <= 5.2e-148) {
tmp = x - a;
} else if (t <= 3.2e-64) {
tmp = t_1;
} else if (t <= 8.5e+33) {
tmp = x - a;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x - (y * a) t_2 = x - (a * (y / t)) tmp = 0 if t <= -2.4: tmp = t_2 elif t <= -3.6e-94: tmp = x - a elif t <= -2e-143: tmp = t_1 elif t <= 5.2e-148: tmp = x - a elif t <= 3.2e-64: tmp = t_1 elif t <= 8.5e+33: tmp = x - a else: tmp = t_2 return tmp
function code(x, y, z, t, a) t_1 = Float64(x - Float64(y * a)) t_2 = Float64(x - Float64(a * Float64(y / t))) tmp = 0.0 if (t <= -2.4) tmp = t_2; elseif (t <= -3.6e-94) tmp = Float64(x - a); elseif (t <= -2e-143) tmp = t_1; elseif (t <= 5.2e-148) tmp = Float64(x - a); elseif (t <= 3.2e-64) tmp = t_1; elseif (t <= 8.5e+33) tmp = Float64(x - a); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x - (y * a); t_2 = x - (a * (y / t)); tmp = 0.0; if (t <= -2.4) tmp = t_2; elseif (t <= -3.6e-94) tmp = x - a; elseif (t <= -2e-143) tmp = t_1; elseif (t <= 5.2e-148) tmp = x - a; elseif (t <= 3.2e-64) tmp = t_1; elseif (t <= 8.5e+33) tmp = x - a; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x - N[(y * a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x - N[(a * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -2.4], t$95$2, If[LessEqual[t, -3.6e-94], N[(x - a), $MachinePrecision], If[LessEqual[t, -2e-143], t$95$1, If[LessEqual[t, 5.2e-148], N[(x - a), $MachinePrecision], If[LessEqual[t, 3.2e-64], t$95$1, If[LessEqual[t, 8.5e+33], N[(x - a), $MachinePrecision], t$95$2]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x - y \cdot a\\
t_2 := x - a \cdot \frac{y}{t}\\
\mathbf{if}\;t \leq -2.4:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t \leq -3.6 \cdot 10^{-94}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;t \leq -2 \cdot 10^{-143}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 5.2 \cdot 10^{-148}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;t \leq 3.2 \cdot 10^{-64}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 8.5 \cdot 10^{+33}:\\
\;\;\;\;x - a\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if t < -2.39999999999999991 or 8.4999999999999998e33 < t Initial program 95.3%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in z around 0 88.4%
Taylor expanded in t around inf 87.8%
if -2.39999999999999991 < t < -3.6e-94 or -1.9999999999999999e-143 < t < 5.20000000000000015e-148 or 3.19999999999999975e-64 < t < 8.4999999999999998e33Initial program 97.2%
associate-/r/100.0%
Simplified100.0%
Taylor expanded in z around inf 72.0%
if -3.6e-94 < t < -1.9999999999999999e-143 or 5.20000000000000015e-148 < t < 3.19999999999999975e-64Initial program 95.0%
associate-/r/99.8%
Simplified99.8%
Taylor expanded in t around 0 99.8%
Taylor expanded in z around 0 71.7%
Final simplification78.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -510000.0) (not (<= z 1.06e-7))) (+ x (* a (/ (- z y) (- 1.0 z)))) (+ x (/ (- z y) (/ (+ t 1.0) a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -510000.0) || !(z <= 1.06e-7)) {
tmp = x + (a * ((z - y) / (1.0 - z)));
} else {
tmp = x + ((z - y) / ((t + 1.0) / a));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((z <= (-510000.0d0)) .or. (.not. (z <= 1.06d-7))) then
tmp = x + (a * ((z - y) / (1.0d0 - z)))
else
tmp = x + ((z - y) / ((t + 1.0d0) / a))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -510000.0) || !(z <= 1.06e-7)) {
tmp = x + (a * ((z - y) / (1.0 - z)));
} else {
tmp = x + ((z - y) / ((t + 1.0) / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -510000.0) or not (z <= 1.06e-7): tmp = x + (a * ((z - y) / (1.0 - z))) else: tmp = x + ((z - y) / ((t + 1.0) / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -510000.0) || !(z <= 1.06e-7)) tmp = Float64(x + Float64(a * Float64(Float64(z - y) / Float64(1.0 - z)))); else tmp = Float64(x + Float64(Float64(z - y) / Float64(Float64(t + 1.0) / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -510000.0) || ~((z <= 1.06e-7))) tmp = x + (a * ((z - y) / (1.0 - z))); else tmp = x + ((z - y) / ((t + 1.0) / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -510000.0], N[Not[LessEqual[z, 1.06e-7]], $MachinePrecision]], N[(x + N[(a * N[(N[(z - y), $MachinePrecision] / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(z - y), $MachinePrecision] / N[(N[(t + 1.0), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -510000 \lor \neg \left(z \leq 1.06 \cdot 10^{-7}\right):\\
\;\;\;\;x + a \cdot \frac{z - y}{1 - z}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z - y}{\frac{t + 1}{a}}\\
\end{array}
\end{array}
if z < -5.1e5 or 1.06e-7 < z Initial program 92.8%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in t around 0 91.0%
if -5.1e5 < z < 1.06e-7Initial program 99.3%
Taylor expanded in z around 0 99.3%
Final simplification95.2%
(FPCore (x y z t a)
:precision binary64
(if (<= t -1.1e+19)
(- x (* a (/ (- y z) t)))
(if (<= t 2.1e+31)
(+ x (* a (/ (- z y) (- 1.0 z))))
(- x (* (/ a t) (- y z))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1.1e+19) {
tmp = x - (a * ((y - z) / t));
} else if (t <= 2.1e+31) {
tmp = x + (a * ((z - y) / (1.0 - z)));
} else {
tmp = x - ((a / t) * (y - z));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (t <= (-1.1d+19)) then
tmp = x - (a * ((y - z) / t))
else if (t <= 2.1d+31) then
tmp = x + (a * ((z - y) / (1.0d0 - z)))
else
tmp = x - ((a / t) * (y - z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1.1e+19) {
tmp = x - (a * ((y - z) / t));
} else if (t <= 2.1e+31) {
tmp = x + (a * ((z - y) / (1.0 - z)));
} else {
tmp = x - ((a / t) * (y - z));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -1.1e+19: tmp = x - (a * ((y - z) / t)) elif t <= 2.1e+31: tmp = x + (a * ((z - y) / (1.0 - z))) else: tmp = x - ((a / t) * (y - z)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -1.1e+19) tmp = Float64(x - Float64(a * Float64(Float64(y - z) / t))); elseif (t <= 2.1e+31) tmp = Float64(x + Float64(a * Float64(Float64(z - y) / Float64(1.0 - z)))); else tmp = Float64(x - Float64(Float64(a / t) * Float64(y - z))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -1.1e+19) tmp = x - (a * ((y - z) / t)); elseif (t <= 2.1e+31) tmp = x + (a * ((z - y) / (1.0 - z))); else tmp = x - ((a / t) * (y - z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -1.1e+19], N[(x - N[(a * N[(N[(y - z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.1e+31], N[(x + N[(a * N[(N[(z - y), $MachinePrecision] / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(N[(a / t), $MachinePrecision] * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.1 \cdot 10^{+19}:\\
\;\;\;\;x - a \cdot \frac{y - z}{t}\\
\mathbf{elif}\;t \leq 2.1 \cdot 10^{+31}:\\
\;\;\;\;x + a \cdot \frac{z - y}{1 - z}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{a}{t} \cdot \left(y - z\right)\\
\end{array}
\end{array}
if t < -1.1e19Initial program 92.2%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in t around inf 91.2%
if -1.1e19 < t < 2.09999999999999979e31Initial program 96.6%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in t around 0 97.5%
if 2.09999999999999979e31 < t Initial program 98.2%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in t around inf 84.4%
associate-/l*91.1%
associate-/r/91.1%
Simplified91.1%
Final simplification94.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -130000000.0) (not (<= z 150.0))) (- (- x a) (/ a z)) (- x (* a (/ y (+ t 1.0))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -130000000.0) || !(z <= 150.0)) {
tmp = (x - a) - (a / z);
} else {
tmp = x - (a * (y / (t + 1.0)));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((z <= (-130000000.0d0)) .or. (.not. (z <= 150.0d0))) then
tmp = (x - a) - (a / z)
else
tmp = x - (a * (y / (t + 1.0d0)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -130000000.0) || !(z <= 150.0)) {
tmp = (x - a) - (a / z);
} else {
tmp = x - (a * (y / (t + 1.0)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -130000000.0) or not (z <= 150.0): tmp = (x - a) - (a / z) else: tmp = x - (a * (y / (t + 1.0))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -130000000.0) || !(z <= 150.0)) tmp = Float64(Float64(x - a) - Float64(a / z)); else tmp = Float64(x - Float64(a * Float64(y / Float64(t + 1.0)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -130000000.0) || ~((z <= 150.0))) tmp = (x - a) - (a / z); else tmp = x - (a * (y / (t + 1.0))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -130000000.0], N[Not[LessEqual[z, 150.0]], $MachinePrecision]], N[(N[(x - a), $MachinePrecision] - N[(a / z), $MachinePrecision]), $MachinePrecision], N[(x - N[(a * N[(y / N[(t + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -130000000 \lor \neg \left(z \leq 150\right):\\
\;\;\;\;\left(x - a\right) - \frac{a}{z}\\
\mathbf{else}:\\
\;\;\;\;x - a \cdot \frac{y}{t + 1}\\
\end{array}
\end{array}
if z < -1.3e8 or 150 < z Initial program 93.2%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in t around 0 91.4%
Taylor expanded in y around 0 65.3%
cancel-sign-sub-inv65.3%
metadata-eval65.3%
*-lft-identity65.3%
Simplified65.3%
Taylor expanded in z around inf 80.0%
associate-+r+80.0%
mul-1-neg80.0%
unsub-neg80.0%
mul-1-neg80.0%
unsub-neg80.0%
Simplified80.0%
if -1.3e8 < z < 150Initial program 98.6%
associate-/r/100.0%
Simplified100.0%
Taylor expanded in z around 0 91.1%
Final simplification85.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -7700000.0) (not (<= z 235.0))) (+ x (- (/ a (/ z y)) a)) (- x (* a (/ y (+ t 1.0))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -7700000.0) || !(z <= 235.0)) {
tmp = x + ((a / (z / y)) - a);
} else {
tmp = x - (a * (y / (t + 1.0)));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((z <= (-7700000.0d0)) .or. (.not. (z <= 235.0d0))) then
tmp = x + ((a / (z / y)) - a)
else
tmp = x - (a * (y / (t + 1.0d0)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -7700000.0) || !(z <= 235.0)) {
tmp = x + ((a / (z / y)) - a);
} else {
tmp = x - (a * (y / (t + 1.0)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -7700000.0) or not (z <= 235.0): tmp = x + ((a / (z / y)) - a) else: tmp = x - (a * (y / (t + 1.0))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -7700000.0) || !(z <= 235.0)) tmp = Float64(x + Float64(Float64(a / Float64(z / y)) - a)); else tmp = Float64(x - Float64(a * Float64(y / Float64(t + 1.0)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -7700000.0) || ~((z <= 235.0))) tmp = x + ((a / (z / y)) - a); else tmp = x - (a * (y / (t + 1.0))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -7700000.0], N[Not[LessEqual[z, 235.0]], $MachinePrecision]], N[(x + N[(N[(a / N[(z / y), $MachinePrecision]), $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision], N[(x - N[(a * N[(y / N[(t + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7700000 \lor \neg \left(z \leq 235\right):\\
\;\;\;\;x + \left(\frac{a}{\frac{z}{y}} - a\right)\\
\mathbf{else}:\\
\;\;\;\;x - a \cdot \frac{y}{t + 1}\\
\end{array}
\end{array}
if z < -7.7e6 or 235 < z Initial program 93.3%
Taylor expanded in z around inf 83.8%
mul-1-neg83.8%
distribute-neg-frac83.8%
Simplified83.8%
frac-2neg83.8%
div-inv83.8%
sub-neg83.8%
distribute-neg-in83.8%
remove-double-neg83.8%
distribute-neg-frac83.8%
remove-double-neg83.8%
add-sqr-sqrt42.9%
sqrt-unprod57.5%
sqr-neg57.5%
sqrt-unprod22.5%
add-sqr-sqrt44.9%
clear-num44.9%
add-sqr-sqrt22.5%
sqrt-unprod57.6%
sqr-neg57.6%
sqrt-unprod43.0%
add-sqr-sqrt83.8%
Applied egg-rr83.8%
associate-*r/71.2%
associate-/l*83.8%
+-commutative83.8%
unsub-neg83.8%
Simplified83.8%
Taylor expanded in z around 0 83.4%
mul-1-neg83.4%
unsub-neg83.4%
associate-/l*90.4%
Simplified90.4%
if -7.7e6 < z < 235Initial program 98.6%
associate-/r/100.0%
Simplified100.0%
Taylor expanded in z around 0 91.7%
Final simplification91.1%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -37000000000.0) (not (<= z 3.6e-22))) (- x a) (- x (* y a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -37000000000.0) || !(z <= 3.6e-22)) {
tmp = x - a;
} else {
tmp = x - (y * a);
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((z <= (-37000000000.0d0)) .or. (.not. (z <= 3.6d-22))) then
tmp = x - a
else
tmp = x - (y * a)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -37000000000.0) || !(z <= 3.6e-22)) {
tmp = x - a;
} else {
tmp = x - (y * a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -37000000000.0) or not (z <= 3.6e-22): tmp = x - a else: tmp = x - (y * a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -37000000000.0) || !(z <= 3.6e-22)) tmp = Float64(x - a); else tmp = Float64(x - Float64(y * a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -37000000000.0) || ~((z <= 3.6e-22))) tmp = x - a; else tmp = x - (y * a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -37000000000.0], N[Not[LessEqual[z, 3.6e-22]], $MachinePrecision]], N[(x - a), $MachinePrecision], N[(x - N[(y * a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -37000000000 \lor \neg \left(z \leq 3.6 \cdot 10^{-22}\right):\\
\;\;\;\;x - a\\
\mathbf{else}:\\
\;\;\;\;x - y \cdot a\\
\end{array}
\end{array}
if z < -3.7e10 or 3.5999999999999998e-22 < z Initial program 92.8%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in z around inf 79.3%
if -3.7e10 < z < 3.5999999999999998e-22Initial program 99.3%
associate-/r/100.0%
Simplified100.0%
Taylor expanded in t around 0 73.4%
Taylor expanded in z around 0 70.9%
Final simplification75.1%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -155000.0) (not (<= z 3.4e-22))) (- x a) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -155000.0) || !(z <= 3.4e-22)) {
tmp = x - a;
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((z <= (-155000.0d0)) .or. (.not. (z <= 3.4d-22))) then
tmp = x - a
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -155000.0) || !(z <= 3.4e-22)) {
tmp = x - a;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -155000.0) or not (z <= 3.4e-22): tmp = x - a else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -155000.0) || !(z <= 3.4e-22)) tmp = Float64(x - a); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -155000.0) || ~((z <= 3.4e-22))) tmp = x - a; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -155000.0], N[Not[LessEqual[z, 3.4e-22]], $MachinePrecision]], N[(x - a), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -155000 \lor \neg \left(z \leq 3.4 \cdot 10^{-22}\right):\\
\;\;\;\;x - a\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -155000 or 3.3999999999999998e-22 < z Initial program 92.9%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in z around inf 78.8%
if -155000 < z < 3.3999999999999998e-22Initial program 99.3%
associate-/r/100.0%
Simplified100.0%
Taylor expanded in t around 0 73.2%
Taylor expanded in x around inf 63.4%
Final simplification71.1%
(FPCore (x y z t a) :precision binary64 x)
double code(double x, double y, double z, double t, double a) {
return x;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x
end function
public static double code(double x, double y, double z, double t, double a) {
return x;
}
def code(x, y, z, t, a): return x
function code(x, y, z, t, a) return x end
function tmp = code(x, y, z, t, a) tmp = x; end
code[x_, y_, z_, t_, a_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 96.1%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in t around 0 81.8%
Taylor expanded in x around inf 56.8%
Final simplification56.8%
(FPCore (x y z t a) :precision binary64 (- x (* (/ (- y z) (+ (- t z) 1.0)) a)))
double code(double x, double y, double z, double t, double a) {
return x - (((y - z) / ((t - z) + 1.0)) * a);
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x - (((y - z) / ((t - z) + 1.0d0)) * a)
end function
public static double code(double x, double y, double z, double t, double a) {
return x - (((y - z) / ((t - z) + 1.0)) * a);
}
def code(x, y, z, t, a): return x - (((y - z) / ((t - z) + 1.0)) * a)
function code(x, y, z, t, a) return Float64(x - Float64(Float64(Float64(y - z) / Float64(Float64(t - z) + 1.0)) * a)) end
function tmp = code(x, y, z, t, a) tmp = x - (((y - z) / ((t - z) + 1.0)) * a); end
code[x_, y_, z_, t_, a_] := N[(x - N[(N[(N[(y - z), $MachinePrecision] / N[(N[(t - z), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{y - z}{\left(t - z\right) + 1} \cdot a
\end{array}
herbie shell --seed 2024027
(FPCore (x y z t a)
:name "Graphics.Rendering.Chart.SparkLine:renderSparkLine from Chart-1.5.3"
:precision binary64
:herbie-target
(- x (* (/ (- y z) (+ (- t z) 1.0)) a))
(- x (/ (- y z) (/ (+ (- t z) 1.0) a))))