
(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 11 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 95.8%
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 (/ y t)))))
(if (<= t -1.35e+34)
t_2
(if (<= t -2.5e-131)
(- x a)
(if (<= t -2.6e-264)
t_1
(if (<= t -6.5e-306)
(- x a)
(if (<= t 55000000000000.0) t_1 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 <= -1.35e+34) {
tmp = t_2;
} else if (t <= -2.5e-131) {
tmp = x - a;
} else if (t <= -2.6e-264) {
tmp = t_1;
} else if (t <= -6.5e-306) {
tmp = x - a;
} else if (t <= 55000000000000.0) {
tmp = t_1;
} 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 <= (-1.35d+34)) then
tmp = t_2
else if (t <= (-2.5d-131)) then
tmp = x - a
else if (t <= (-2.6d-264)) then
tmp = t_1
else if (t <= (-6.5d-306)) then
tmp = x - a
else if (t <= 55000000000000.0d0) then
tmp = t_1
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 <= -1.35e+34) {
tmp = t_2;
} else if (t <= -2.5e-131) {
tmp = x - a;
} else if (t <= -2.6e-264) {
tmp = t_1;
} else if (t <= -6.5e-306) {
tmp = x - a;
} else if (t <= 55000000000000.0) {
tmp = t_1;
} 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 <= -1.35e+34: tmp = t_2 elif t <= -2.5e-131: tmp = x - a elif t <= -2.6e-264: tmp = t_1 elif t <= -6.5e-306: tmp = x - a elif t <= 55000000000000.0: tmp = t_1 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 <= -1.35e+34) tmp = t_2; elseif (t <= -2.5e-131) tmp = Float64(x - a); elseif (t <= -2.6e-264) tmp = t_1; elseif (t <= -6.5e-306) tmp = Float64(x - a); elseif (t <= 55000000000000.0) tmp = t_1; 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 <= -1.35e+34) tmp = t_2; elseif (t <= -2.5e-131) tmp = x - a; elseif (t <= -2.6e-264) tmp = t_1; elseif (t <= -6.5e-306) tmp = x - a; elseif (t <= 55000000000000.0) tmp = t_1; 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, -1.35e+34], t$95$2, If[LessEqual[t, -2.5e-131], N[(x - a), $MachinePrecision], If[LessEqual[t, -2.6e-264], t$95$1, If[LessEqual[t, -6.5e-306], N[(x - a), $MachinePrecision], If[LessEqual[t, 55000000000000.0], t$95$1, 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 -1.35 \cdot 10^{+34}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t \leq -2.5 \cdot 10^{-131}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;t \leq -2.6 \cdot 10^{-264}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq -6.5 \cdot 10^{-306}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;t \leq 55000000000000:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if t < -1.35e34 or 5.5e13 < t Initial program 94.3%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in t around inf 88.4%
Taylor expanded in y around inf 76.0%
associate-/l*79.9%
associate-/r/83.1%
Simplified83.1%
if -1.35e34 < t < -2.5000000000000002e-131 or -2.6000000000000002e-264 < t < -6.5000000000000004e-306Initial program 95.9%
associate-/r/100.0%
Simplified100.0%
Taylor expanded in z around inf 75.4%
if -2.5000000000000002e-131 < t < -2.6000000000000002e-264 or -6.5000000000000004e-306 < t < 5.5e13Initial program 97.8%
associate-/r/100.0%
Simplified100.0%
Taylor expanded in t around 0 100.0%
Taylor expanded in z around 0 77.5%
Final simplification79.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (/ a (/ (- 1.0 z) z)))) (t_2 (- x (* a (/ y t)))))
(if (<= t -1.1e+34)
t_2
(if (<= t 4.9e-254)
t_1
(if (<= t 4.45e-107) (- x (* y a)) (if (<= t 3.4e+24) t_1 t_2))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (a / ((1.0 - z) / z));
double t_2 = x - (a * (y / t));
double tmp;
if (t <= -1.1e+34) {
tmp = t_2;
} else if (t <= 4.9e-254) {
tmp = t_1;
} else if (t <= 4.45e-107) {
tmp = x - (y * a);
} else if (t <= 3.4e+24) {
tmp = t_1;
} 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 + (a / ((1.0d0 - z) / z))
t_2 = x - (a * (y / t))
if (t <= (-1.1d+34)) then
tmp = t_2
else if (t <= 4.9d-254) then
tmp = t_1
else if (t <= 4.45d-107) then
tmp = x - (y * a)
else if (t <= 3.4d+24) then
tmp = t_1
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 + (a / ((1.0 - z) / z));
double t_2 = x - (a * (y / t));
double tmp;
if (t <= -1.1e+34) {
tmp = t_2;
} else if (t <= 4.9e-254) {
tmp = t_1;
} else if (t <= 4.45e-107) {
tmp = x - (y * a);
} else if (t <= 3.4e+24) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + (a / ((1.0 - z) / z)) t_2 = x - (a * (y / t)) tmp = 0 if t <= -1.1e+34: tmp = t_2 elif t <= 4.9e-254: tmp = t_1 elif t <= 4.45e-107: tmp = x - (y * a) elif t <= 3.4e+24: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(a / Float64(Float64(1.0 - z) / z))) t_2 = Float64(x - Float64(a * Float64(y / t))) tmp = 0.0 if (t <= -1.1e+34) tmp = t_2; elseif (t <= 4.9e-254) tmp = t_1; elseif (t <= 4.45e-107) tmp = Float64(x - Float64(y * a)); elseif (t <= 3.4e+24) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + (a / ((1.0 - z) / z)); t_2 = x - (a * (y / t)); tmp = 0.0; if (t <= -1.1e+34) tmp = t_2; elseif (t <= 4.9e-254) tmp = t_1; elseif (t <= 4.45e-107) tmp = x - (y * a); elseif (t <= 3.4e+24) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(a / N[(N[(1.0 - z), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x - N[(a * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -1.1e+34], t$95$2, If[LessEqual[t, 4.9e-254], t$95$1, If[LessEqual[t, 4.45e-107], N[(x - N[(y * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 3.4e+24], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{a}{\frac{1 - z}{z}}\\
t_2 := x - a \cdot \frac{y}{t}\\
\mathbf{if}\;t \leq -1.1 \cdot 10^{+34}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t \leq 4.9 \cdot 10^{-254}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 4.45 \cdot 10^{-107}:\\
\;\;\;\;x - y \cdot a\\
\mathbf{elif}\;t \leq 3.4 \cdot 10^{+24}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if t < -1.1000000000000001e34 or 3.4000000000000001e24 < t Initial program 94.2%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in t around inf 88.2%
Taylor expanded in y around inf 76.4%
associate-/l*80.3%
associate-/r/83.6%
Simplified83.6%
if -1.1000000000000001e34 < t < 4.8999999999999998e-254 or 4.4500000000000002e-107 < t < 3.4000000000000001e24Initial program 98.2%
associate-/r/100.0%
Simplified100.0%
Taylor expanded in t around 0 97.5%
Taylor expanded in y around 0 73.5%
sub-neg73.5%
mul-1-neg73.5%
remove-double-neg73.5%
associate-/l*80.4%
Simplified80.4%
if 4.8999999999999998e-254 < t < 4.4500000000000002e-107Initial program 93.3%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in t around 0 99.9%
Taylor expanded in z around 0 76.5%
Final simplification81.4%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -1.3e+34) (not (<= t 6.5e+17))) (+ x (* a (/ (- z y) t))) (+ x (* a (/ (- z y) (- 1.0 z))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -1.3e+34) || !(t <= 6.5e+17)) {
tmp = x + (a * ((z - y) / t));
} else {
tmp = x + (a * ((z - y) / (1.0 - 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.3d+34)) .or. (.not. (t <= 6.5d+17))) then
tmp = x + (a * ((z - y) / t))
else
tmp = x + (a * ((z - y) / (1.0d0 - 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.3e+34) || !(t <= 6.5e+17)) {
tmp = x + (a * ((z - y) / t));
} else {
tmp = x + (a * ((z - y) / (1.0 - z)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -1.3e+34) or not (t <= 6.5e+17): tmp = x + (a * ((z - y) / t)) else: tmp = x + (a * ((z - y) / (1.0 - z))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -1.3e+34) || !(t <= 6.5e+17)) tmp = Float64(x + Float64(a * Float64(Float64(z - y) / t))); else tmp = Float64(x + Float64(a * Float64(Float64(z - y) / Float64(1.0 - z)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -1.3e+34) || ~((t <= 6.5e+17))) tmp = x + (a * ((z - y) / t)); else tmp = x + (a * ((z - y) / (1.0 - z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -1.3e+34], N[Not[LessEqual[t, 6.5e+17]], $MachinePrecision]], N[(x + N[(a * N[(N[(z - y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(a * N[(N[(z - y), $MachinePrecision] / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.3 \cdot 10^{+34} \lor \neg \left(t \leq 6.5 \cdot 10^{+17}\right):\\
\;\;\;\;x + a \cdot \frac{z - y}{t}\\
\mathbf{else}:\\
\;\;\;\;x + a \cdot \frac{z - y}{1 - z}\\
\end{array}
\end{array}
if t < -1.29999999999999999e34 or 6.5e17 < t Initial program 94.3%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in t around inf 88.4%
if -1.29999999999999999e34 < t < 6.5e17Initial program 97.1%
associate-/r/100.0%
Simplified100.0%
Taylor expanded in t around 0 99.2%
Final simplification94.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.65e-9) (not (<= z 2.3e-15))) (+ x (* a (/ (- z y) (- 1.0 z)))) (- x (/ (- y z) (/ (+ t 1.0) a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.65e-9) || !(z <= 2.3e-15)) {
tmp = x + (a * ((z - y) / (1.0 - z)));
} else {
tmp = x - ((y - z) / ((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 <= (-1.65d-9)) .or. (.not. (z <= 2.3d-15))) then
tmp = x + (a * ((z - y) / (1.0d0 - z)))
else
tmp = x - ((y - z) / ((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 <= -1.65e-9) || !(z <= 2.3e-15)) {
tmp = x + (a * ((z - y) / (1.0 - z)));
} else {
tmp = x - ((y - z) / ((t + 1.0) / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.65e-9) or not (z <= 2.3e-15): tmp = x + (a * ((z - y) / (1.0 - z))) else: tmp = x - ((y - z) / ((t + 1.0) / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.65e-9) || !(z <= 2.3e-15)) tmp = Float64(x + Float64(a * Float64(Float64(z - y) / Float64(1.0 - z)))); else tmp = Float64(x - Float64(Float64(y - z) / Float64(Float64(t + 1.0) / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -1.65e-9) || ~((z <= 2.3e-15))) tmp = x + (a * ((z - y) / (1.0 - z))); else tmp = x - ((y - z) / ((t + 1.0) / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.65e-9], N[Not[LessEqual[z, 2.3e-15]], $MachinePrecision]], N[(x + N[(a * N[(N[(z - y), $MachinePrecision] / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(N[(y - z), $MachinePrecision] / N[(N[(t + 1.0), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.65 \cdot 10^{-9} \lor \neg \left(z \leq 2.3 \cdot 10^{-15}\right):\\
\;\;\;\;x + a \cdot \frac{z - y}{1 - z}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y - z}{\frac{t + 1}{a}}\\
\end{array}
\end{array}
if z < -1.65000000000000009e-9 or 2.2999999999999999e-15 < z Initial program 94.8%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in t around 0 91.5%
if -1.65000000000000009e-9 < z < 2.2999999999999999e-15Initial program 96.9%
Taylor expanded in z around 0 96.9%
Final simplification94.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.65e-9) (not (<= z 2.3e-15))) (+ x (/ (- z y) (/ (- z) a))) (- x (* a (/ y (+ t 1.0))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.65e-9) || !(z <= 2.3e-15)) {
tmp = x + ((z - y) / (-z / 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 <= (-1.65d-9)) .or. (.not. (z <= 2.3d-15))) then
tmp = x + ((z - y) / (-z / 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 <= -1.65e-9) || !(z <= 2.3e-15)) {
tmp = x + ((z - y) / (-z / a));
} else {
tmp = x - (a * (y / (t + 1.0)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.65e-9) or not (z <= 2.3e-15): tmp = x + ((z - y) / (-z / a)) else: tmp = x - (a * (y / (t + 1.0))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.65e-9) || !(z <= 2.3e-15)) tmp = Float64(x + Float64(Float64(z - y) / Float64(Float64(-z) / 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 <= -1.65e-9) || ~((z <= 2.3e-15))) tmp = x + ((z - y) / (-z / a)); else tmp = x - (a * (y / (t + 1.0))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.65e-9], N[Not[LessEqual[z, 2.3e-15]], $MachinePrecision]], N[(x + N[(N[(z - y), $MachinePrecision] / N[((-z) / a), $MachinePrecision]), $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 -1.65 \cdot 10^{-9} \lor \neg \left(z \leq 2.3 \cdot 10^{-15}\right):\\
\;\;\;\;x + \frac{z - y}{\frac{-z}{a}}\\
\mathbf{else}:\\
\;\;\;\;x - a \cdot \frac{y}{t + 1}\\
\end{array}
\end{array}
if z < -1.65000000000000009e-9 or 2.2999999999999999e-15 < z Initial program 94.8%
Taylor expanded in z around inf 85.3%
mul-1-neg85.3%
distribute-neg-frac85.3%
Simplified85.3%
if -1.65000000000000009e-9 < z < 2.2999999999999999e-15Initial program 96.9%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in z around 0 94.1%
Final simplification89.7%
(FPCore (x y z t a)
:precision binary64
(if (<= z -1.6e+84)
(- x a)
(if (<= z 2.3e-15)
(- x (* a (/ y (+ t 1.0))))
(+ x (/ a (/ (- 1.0 z) z))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.6e+84) {
tmp = x - a;
} else if (z <= 2.3e-15) {
tmp = x - (a * (y / (t + 1.0)));
} else {
tmp = x + (a / ((1.0 - z) / 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 (z <= (-1.6d+84)) then
tmp = x - a
else if (z <= 2.3d-15) then
tmp = x - (a * (y / (t + 1.0d0)))
else
tmp = x + (a / ((1.0d0 - z) / z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.6e+84) {
tmp = x - a;
} else if (z <= 2.3e-15) {
tmp = x - (a * (y / (t + 1.0)));
} else {
tmp = x + (a / ((1.0 - z) / z));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1.6e+84: tmp = x - a elif z <= 2.3e-15: tmp = x - (a * (y / (t + 1.0))) else: tmp = x + (a / ((1.0 - z) / z)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.6e+84) tmp = Float64(x - a); elseif (z <= 2.3e-15) tmp = Float64(x - Float64(a * Float64(y / Float64(t + 1.0)))); else tmp = Float64(x + Float64(a / Float64(Float64(1.0 - z) / z))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -1.6e+84) tmp = x - a; elseif (z <= 2.3e-15) tmp = x - (a * (y / (t + 1.0))); else tmp = x + (a / ((1.0 - z) / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.6e+84], N[(x - a), $MachinePrecision], If[LessEqual[z, 2.3e-15], N[(x - N[(a * N[(y / N[(t + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(a / N[(N[(1.0 - z), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.6 \cdot 10^{+84}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 2.3 \cdot 10^{-15}:\\
\;\;\;\;x - a \cdot \frac{y}{t + 1}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{a}{\frac{1 - z}{z}}\\
\end{array}
\end{array}
if z < -1.60000000000000005e84Initial program 94.0%
associate-/r/100.0%
Simplified100.0%
Taylor expanded in z around inf 89.4%
if -1.60000000000000005e84 < z < 2.2999999999999999e-15Initial program 96.6%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in z around 0 89.7%
if 2.2999999999999999e-15 < z Initial program 95.4%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in t around 0 92.3%
Taylor expanded in y around 0 72.2%
sub-neg72.2%
mul-1-neg72.2%
remove-double-neg72.2%
associate-/l*84.5%
Simplified84.5%
Final simplification88.4%
(FPCore (x y z t a) :precision binary64 (if (<= z -60000.0) (- x a) (if (<= z 2e-33) (+ x (* z a)) (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -60000.0) {
tmp = x - a;
} else if (z <= 2e-33) {
tmp = x + (z * a);
} else {
tmp = x - 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 <= (-60000.0d0)) then
tmp = x - a
else if (z <= 2d-33) then
tmp = x + (z * a)
else
tmp = x - 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 <= -60000.0) {
tmp = x - a;
} else if (z <= 2e-33) {
tmp = x + (z * a);
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -60000.0: tmp = x - a elif z <= 2e-33: tmp = x + (z * a) else: tmp = x - a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -60000.0) tmp = Float64(x - a); elseif (z <= 2e-33) tmp = Float64(x + Float64(z * a)); else tmp = Float64(x - a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -60000.0) tmp = x - a; elseif (z <= 2e-33) tmp = x + (z * a); else tmp = x - a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -60000.0], N[(x - a), $MachinePrecision], If[LessEqual[z, 2e-33], N[(x + N[(z * a), $MachinePrecision]), $MachinePrecision], N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -60000:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 2 \cdot 10^{-33}:\\
\;\;\;\;x + z \cdot a\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -6e4 or 2.0000000000000001e-33 < z Initial program 94.9%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in z around inf 81.4%
if -6e4 < z < 2.0000000000000001e-33Initial program 96.8%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in t around 0 70.7%
Taylor expanded in y around 0 55.1%
associate-*r/55.1%
associate-*r*55.1%
mul-1-neg55.1%
Simplified55.1%
Taylor expanded in z around 0 54.8%
Final simplification68.4%
(FPCore (x y z t a) :precision binary64 (if (<= z -5.2e-20) (- x a) (if (<= z 2.8e-33) (- x (* y a)) (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -5.2e-20) {
tmp = x - a;
} else if (z <= 2.8e-33) {
tmp = x - (y * a);
} else {
tmp = x - 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 <= (-5.2d-20)) then
tmp = x - a
else if (z <= 2.8d-33) then
tmp = x - (y * a)
else
tmp = x - 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 <= -5.2e-20) {
tmp = x - a;
} else if (z <= 2.8e-33) {
tmp = x - (y * a);
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -5.2e-20: tmp = x - a elif z <= 2.8e-33: tmp = x - (y * a) else: tmp = x - a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -5.2e-20) tmp = Float64(x - a); elseif (z <= 2.8e-33) tmp = Float64(x - Float64(y * a)); else tmp = Float64(x - a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -5.2e-20) tmp = x - a; elseif (z <= 2.8e-33) tmp = x - (y * a); else tmp = x - a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -5.2e-20], N[(x - a), $MachinePrecision], If[LessEqual[z, 2.8e-33], N[(x - N[(y * a), $MachinePrecision]), $MachinePrecision], N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.2 \cdot 10^{-20}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 2.8 \cdot 10^{-33}:\\
\;\;\;\;x - y \cdot a\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -5.1999999999999999e-20 or 2.8e-33 < z Initial program 94.3%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in z around inf 79.8%
if -5.1999999999999999e-20 < z < 2.8e-33Initial program 97.5%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in t around 0 71.6%
Taylor expanded in z around 0 68.7%
Final simplification74.5%
(FPCore (x y z t a) :precision binary64 (if (<= z -6.5e+80) (- x a) (if (<= z 2.25e-33) x (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -6.5e+80) {
tmp = x - a;
} else if (z <= 2.25e-33) {
tmp = x;
} else {
tmp = x - 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 <= (-6.5d+80)) then
tmp = x - a
else if (z <= 2.25d-33) then
tmp = x
else
tmp = x - 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 <= -6.5e+80) {
tmp = x - a;
} else if (z <= 2.25e-33) {
tmp = x;
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -6.5e+80: tmp = x - a elif z <= 2.25e-33: tmp = x else: tmp = x - a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -6.5e+80) tmp = Float64(x - a); elseif (z <= 2.25e-33) tmp = x; else tmp = Float64(x - a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -6.5e+80) tmp = x - a; elseif (z <= 2.25e-33) tmp = x; else tmp = x - a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -6.5e+80], N[(x - a), $MachinePrecision], If[LessEqual[z, 2.25e-33], x, N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.5 \cdot 10^{+80}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 2.25 \cdot 10^{-33}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -6.4999999999999998e80 or 2.24999999999999995e-33 < z Initial program 95.0%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in z around inf 84.9%
if -6.4999999999999998e80 < z < 2.24999999999999995e-33Initial program 96.5%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in x around inf 54.8%
Final simplification68.3%
(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 95.8%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in x around inf 56.3%
Final simplification56.3%
(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 2023176
(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))))