
(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 (fma (/ (- z y) (+ (- t z) 1.0)) a x))
double code(double x, double y, double z, double t, double a) {
return fma(((z - y) / ((t - z) + 1.0)), a, x);
}
function code(x, y, z, t, a) return fma(Float64(Float64(z - y) / Float64(Float64(t - z) + 1.0)), a, x) end
code[x_, y_, z_, t_, a_] := N[(N[(N[(z - y), $MachinePrecision] / N[(N[(t - z), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{z - y}{\left(t - z\right) + 1}, a, x\right)
\end{array}
Initial program 98.7%
sub-neg98.7%
+-commutative98.7%
associate-/r/99.9%
distribute-lft-neg-in99.9%
fma-def99.9%
distribute-neg-frac99.9%
sub-neg99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
+-commutative99.9%
sub-neg99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- x (* y (/ a t)))))
(if (<= t -1.0)
t_1
(if (<= t 7.1e-90)
(- x (* y a))
(if (<= t 6e+79) (+ x (/ a (/ (- 1.0 z) z))) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x - (y * (a / t));
double tmp;
if (t <= -1.0) {
tmp = t_1;
} else if (t <= 7.1e-90) {
tmp = x - (y * a);
} else if (t <= 6e+79) {
tmp = x + (a / ((1.0 - z) / z));
} else {
tmp = t_1;
}
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) :: tmp
t_1 = x - (y * (a / t))
if (t <= (-1.0d0)) then
tmp = t_1
else if (t <= 7.1d-90) then
tmp = x - (y * a)
else if (t <= 6d+79) then
tmp = x + (a / ((1.0d0 - z) / z))
else
tmp = t_1
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 / t));
double tmp;
if (t <= -1.0) {
tmp = t_1;
} else if (t <= 7.1e-90) {
tmp = x - (y * a);
} else if (t <= 6e+79) {
tmp = x + (a / ((1.0 - z) / z));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x - (y * (a / t)) tmp = 0 if t <= -1.0: tmp = t_1 elif t <= 7.1e-90: tmp = x - (y * a) elif t <= 6e+79: tmp = x + (a / ((1.0 - z) / z)) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(x - Float64(y * Float64(a / t))) tmp = 0.0 if (t <= -1.0) tmp = t_1; elseif (t <= 7.1e-90) tmp = Float64(x - Float64(y * a)); elseif (t <= 6e+79) tmp = Float64(x + Float64(a / Float64(Float64(1.0 - z) / z))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x - (y * (a / t)); tmp = 0.0; if (t <= -1.0) tmp = t_1; elseif (t <= 7.1e-90) tmp = x - (y * a); elseif (t <= 6e+79) tmp = x + (a / ((1.0 - z) / z)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x - N[(y * N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -1.0], t$95$1, If[LessEqual[t, 7.1e-90], N[(x - N[(y * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 6e+79], N[(x + N[(a / N[(N[(1.0 - z), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x - y \cdot \frac{a}{t}\\
\mathbf{if}\;t \leq -1:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 7.1 \cdot 10^{-90}:\\
\;\;\;\;x - y \cdot a\\
\mathbf{elif}\;t \leq 6 \cdot 10^{+79}:\\
\;\;\;\;x + \frac{a}{\frac{1 - z}{z}}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if t < -1 or 5.99999999999999948e79 < t Initial program 98.9%
associate-/r/99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in y around inf 75.7%
associate--l+75.7%
+-commutative75.7%
associate-*r/82.4%
+-commutative82.4%
Simplified82.4%
Taylor expanded in t around inf 80.8%
if -1 < t < 7.1000000000000001e-90Initial program 99.0%
associate-/r/100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in z around 0 71.4%
Taylor expanded in t around 0 71.4%
*-commutative71.4%
Simplified71.4%
if 7.1000000000000001e-90 < t < 5.99999999999999948e79Initial program 96.9%
associate-/r/99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in t around 0 84.6%
Taylor expanded in y around 0 63.2%
sub-neg63.2%
mul-1-neg63.2%
remove-double-neg63.2%
associate-/l*66.1%
Simplified66.1%
Final simplification74.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- x (* a (/ (- y z) t)))))
(if (<= t -1.1)
t_1
(if (<= t 9.6e-90)
(- x (* y a))
(if (<= t 46000000000000.0) (+ x (/ a (/ (- 1.0 z) z))) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x - (a * ((y - z) / t));
double tmp;
if (t <= -1.1) {
tmp = t_1;
} else if (t <= 9.6e-90) {
tmp = x - (y * a);
} else if (t <= 46000000000000.0) {
tmp = x + (a / ((1.0 - z) / z));
} else {
tmp = t_1;
}
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) :: tmp
t_1 = x - (a * ((y - z) / t))
if (t <= (-1.1d0)) then
tmp = t_1
else if (t <= 9.6d-90) then
tmp = x - (y * a)
else if (t <= 46000000000000.0d0) then
tmp = x + (a / ((1.0d0 - z) / z))
else
tmp = t_1
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 * ((y - z) / t));
double tmp;
if (t <= -1.1) {
tmp = t_1;
} else if (t <= 9.6e-90) {
tmp = x - (y * a);
} else if (t <= 46000000000000.0) {
tmp = x + (a / ((1.0 - z) / z));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x - (a * ((y - z) / t)) tmp = 0 if t <= -1.1: tmp = t_1 elif t <= 9.6e-90: tmp = x - (y * a) elif t <= 46000000000000.0: tmp = x + (a / ((1.0 - z) / z)) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(x - Float64(a * Float64(Float64(y - z) / t))) tmp = 0.0 if (t <= -1.1) tmp = t_1; elseif (t <= 9.6e-90) tmp = Float64(x - Float64(y * a)); elseif (t <= 46000000000000.0) tmp = Float64(x + Float64(a / Float64(Float64(1.0 - z) / z))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x - (a * ((y - z) / t)); tmp = 0.0; if (t <= -1.1) tmp = t_1; elseif (t <= 9.6e-90) tmp = x - (y * a); elseif (t <= 46000000000000.0) tmp = x + (a / ((1.0 - z) / z)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x - N[(a * N[(N[(y - z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -1.1], t$95$1, If[LessEqual[t, 9.6e-90], N[(x - N[(y * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 46000000000000.0], N[(x + N[(a / N[(N[(1.0 - z), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x - a \cdot \frac{y - z}{t}\\
\mathbf{if}\;t \leq -1.1:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 9.6 \cdot 10^{-90}:\\
\;\;\;\;x - y \cdot a\\
\mathbf{elif}\;t \leq 46000000000000:\\
\;\;\;\;x + \frac{a}{\frac{1 - z}{z}}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if t < -1.1000000000000001 or 4.6e13 < t Initial program 98.2%
associate-/r/99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in t around inf 87.3%
if -1.1000000000000001 < t < 9.6000000000000006e-90Initial program 99.0%
associate-/r/100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in z around 0 71.4%
Taylor expanded in t around 0 71.4%
*-commutative71.4%
Simplified71.4%
if 9.6000000000000006e-90 < t < 4.6e13Initial program 99.9%
associate-/r/99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in t around 0 93.6%
Taylor expanded in y around 0 75.1%
sub-neg75.1%
mul-1-neg75.1%
remove-double-neg75.1%
associate-/l*75.1%
Simplified75.1%
Final simplification79.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -3.2) (not (<= t 8.2e+79))) (- x (* a (/ (- y z) t))) (+ x (* a (/ (- z y) (- 1.0 z))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -3.2) || !(t <= 8.2e+79)) {
tmp = x - (a * ((y - z) / 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 <= (-3.2d0)) .or. (.not. (t <= 8.2d+79))) then
tmp = x - (a * ((y - z) / 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 <= -3.2) || !(t <= 8.2e+79)) {
tmp = x - (a * ((y - z) / t));
} else {
tmp = x + (a * ((z - y) / (1.0 - z)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -3.2) or not (t <= 8.2e+79): tmp = x - (a * ((y - z) / t)) else: tmp = x + (a * ((z - y) / (1.0 - z))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -3.2) || !(t <= 8.2e+79)) tmp = Float64(x - Float64(a * Float64(Float64(y - z) / 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 <= -3.2) || ~((t <= 8.2e+79))) tmp = x - (a * ((y - z) / 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, -3.2], N[Not[LessEqual[t, 8.2e+79]], $MachinePrecision]], N[(x - N[(a * N[(N[(y - z), $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 -3.2 \lor \neg \left(t \leq 8.2 \cdot 10^{+79}\right):\\
\;\;\;\;x - a \cdot \frac{y - z}{t}\\
\mathbf{else}:\\
\;\;\;\;x + a \cdot \frac{z - y}{1 - z}\\
\end{array}
\end{array}
if t < -3.2000000000000002 or 8.2e79 < t Initial program 98.9%
associate-/r/99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in t around inf 90.4%
if -3.2000000000000002 < t < 8.2e79Initial program 98.5%
associate-/r/100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in t around 0 96.5%
Final simplification93.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -8e+46) (not (<= z 4e-8))) (- x (/ (- y z) (- (/ z a)))) (- x (/ (* y a) (+ t 1.0)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -8e+46) || !(z <= 4e-8)) {
tmp = x - ((y - z) / -(z / a));
} else {
tmp = x - ((y * a) / (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 <= (-8d+46)) .or. (.not. (z <= 4d-8))) then
tmp = x - ((y - z) / -(z / a))
else
tmp = x - ((y * a) / (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 <= -8e+46) || !(z <= 4e-8)) {
tmp = x - ((y - z) / -(z / a));
} else {
tmp = x - ((y * a) / (t + 1.0));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -8e+46) or not (z <= 4e-8): tmp = x - ((y - z) / -(z / a)) else: tmp = x - ((y * a) / (t + 1.0)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -8e+46) || !(z <= 4e-8)) tmp = Float64(x - Float64(Float64(y - z) / Float64(-Float64(z / a)))); else tmp = Float64(x - Float64(Float64(y * a) / Float64(t + 1.0))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -8e+46) || ~((z <= 4e-8))) tmp = x - ((y - z) / -(z / a)); else tmp = x - ((y * a) / (t + 1.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -8e+46], N[Not[LessEqual[z, 4e-8]], $MachinePrecision]], N[(x - N[(N[(y - z), $MachinePrecision] / (-N[(z / a), $MachinePrecision])), $MachinePrecision]), $MachinePrecision], N[(x - N[(N[(y * a), $MachinePrecision] / N[(t + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8 \cdot 10^{+46} \lor \neg \left(z \leq 4 \cdot 10^{-8}\right):\\
\;\;\;\;x - \frac{y - z}{-\frac{z}{a}}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y \cdot a}{t + 1}\\
\end{array}
\end{array}
if z < -7.9999999999999999e46 or 4.0000000000000001e-8 < z Initial program 97.9%
Taylor expanded in z around inf 88.8%
mul-1-neg88.8%
distribute-neg-frac88.8%
Simplified88.8%
if -7.9999999999999999e46 < z < 4.0000000000000001e-8Initial program 99.2%
associate-/r/99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in z around 0 85.4%
Final simplification86.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- x (* y (/ a t)))))
(if (<= t -6.8e-10)
t_1
(if (<= t 2.6e-89) (- x (* y a)) (if (<= t 7e+79) (- x a) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x - (y * (a / t));
double tmp;
if (t <= -6.8e-10) {
tmp = t_1;
} else if (t <= 2.6e-89) {
tmp = x - (y * a);
} else if (t <= 7e+79) {
tmp = x - a;
} else {
tmp = t_1;
}
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) :: tmp
t_1 = x - (y * (a / t))
if (t <= (-6.8d-10)) then
tmp = t_1
else if (t <= 2.6d-89) then
tmp = x - (y * a)
else if (t <= 7d+79) then
tmp = x - a
else
tmp = t_1
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 / t));
double tmp;
if (t <= -6.8e-10) {
tmp = t_1;
} else if (t <= 2.6e-89) {
tmp = x - (y * a);
} else if (t <= 7e+79) {
tmp = x - a;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x - (y * (a / t)) tmp = 0 if t <= -6.8e-10: tmp = t_1 elif t <= 2.6e-89: tmp = x - (y * a) elif t <= 7e+79: tmp = x - a else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(x - Float64(y * Float64(a / t))) tmp = 0.0 if (t <= -6.8e-10) tmp = t_1; elseif (t <= 2.6e-89) tmp = Float64(x - Float64(y * a)); elseif (t <= 7e+79) tmp = Float64(x - a); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x - (y * (a / t)); tmp = 0.0; if (t <= -6.8e-10) tmp = t_1; elseif (t <= 2.6e-89) tmp = x - (y * a); elseif (t <= 7e+79) tmp = x - a; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x - N[(y * N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -6.8e-10], t$95$1, If[LessEqual[t, 2.6e-89], N[(x - N[(y * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 7e+79], N[(x - a), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x - y \cdot \frac{a}{t}\\
\mathbf{if}\;t \leq -6.8 \cdot 10^{-10}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 2.6 \cdot 10^{-89}:\\
\;\;\;\;x - y \cdot a\\
\mathbf{elif}\;t \leq 7 \cdot 10^{+79}:\\
\;\;\;\;x - a\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if t < -6.8000000000000003e-10 or 6.99999999999999961e79 < t Initial program 98.9%
associate-/r/99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in y around inf 75.7%
associate--l+75.7%
+-commutative75.7%
associate-*r/82.4%
+-commutative82.4%
Simplified82.4%
Taylor expanded in t around inf 80.8%
if -6.8000000000000003e-10 < t < 2.5999999999999999e-89Initial program 99.0%
associate-/r/100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in z around 0 71.4%
Taylor expanded in t around 0 71.4%
*-commutative71.4%
Simplified71.4%
if 2.5999999999999999e-89 < t < 6.99999999999999961e79Initial program 96.9%
associate-/r/99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in z around inf 63.5%
Final simplification74.4%
(FPCore (x y z t a)
:precision binary64
(if (<= z -9.8e+76)
(- x a)
(if (<= z 3.1e-10)
(- x (/ (* y a) (+ 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 <= -9.8e+76) {
tmp = x - a;
} else if (z <= 3.1e-10) {
tmp = x - ((y * a) / (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 <= (-9.8d+76)) then
tmp = x - a
else if (z <= 3.1d-10) then
tmp = x - ((y * a) / (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 <= -9.8e+76) {
tmp = x - a;
} else if (z <= 3.1e-10) {
tmp = x - ((y * a) / (t + 1.0));
} else {
tmp = x + (a / ((1.0 - z) / z));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -9.8e+76: tmp = x - a elif z <= 3.1e-10: tmp = x - ((y * a) / (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 <= -9.8e+76) tmp = Float64(x - a); elseif (z <= 3.1e-10) tmp = Float64(x - Float64(Float64(y * a) / 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 <= -9.8e+76) tmp = x - a; elseif (z <= 3.1e-10) tmp = x - ((y * a) / (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, -9.8e+76], N[(x - a), $MachinePrecision], If[LessEqual[z, 3.1e-10], N[(x - N[(N[(y * a), $MachinePrecision] / N[(t + 1.0), $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 -9.8 \cdot 10^{+76}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 3.1 \cdot 10^{-10}:\\
\;\;\;\;x - \frac{y \cdot a}{t + 1}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{a}{\frac{1 - z}{z}}\\
\end{array}
\end{array}
if z < -9.80000000000000053e76Initial program 97.5%
associate-/r/100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in z around inf 87.2%
if -9.80000000000000053e76 < z < 3.10000000000000015e-10Initial program 99.2%
associate-/r/99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in z around 0 84.8%
if 3.10000000000000015e-10 < z Initial program 98.0%
associate-/r/99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in t around 0 86.1%
Taylor expanded in y around 0 70.6%
sub-neg70.6%
mul-1-neg70.6%
remove-double-neg70.6%
associate-/l*79.3%
Simplified79.3%
Final simplification84.0%
(FPCore (x y z t a) :precision binary64 (- x (* a (/ (- y z) (+ (- t z) 1.0)))))
double code(double x, double y, double z, double t, double a) {
return x - (a * ((y - z) / ((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 * ((y - z) / ((t - z) + 1.0d0)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x - (a * ((y - z) / ((t - z) + 1.0)));
}
def code(x, y, z, t, a): return x - (a * ((y - z) / ((t - z) + 1.0)))
function code(x, y, z, t, a) return Float64(x - Float64(a * Float64(Float64(y - z) / Float64(Float64(t - z) + 1.0)))) end
function tmp = code(x, y, z, t, a) tmp = x - (a * ((y - z) / ((t - z) + 1.0))); end
code[x_, y_, z_, t_, a_] := N[(x - N[(a * N[(N[(y - z), $MachinePrecision] / N[(N[(t - z), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - a \cdot \frac{y - z}{\left(t - z\right) + 1}
\end{array}
Initial program 98.7%
associate-/r/99.9%
*-commutative99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z t a) :precision binary64 (if (<= z -2.5e+71) (- x a) (if (<= z 1.2e-8) (- x (* y a)) (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.5e+71) {
tmp = x - a;
} else if (z <= 1.2e-8) {
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 <= (-2.5d+71)) then
tmp = x - a
else if (z <= 1.2d-8) 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 <= -2.5e+71) {
tmp = x - a;
} else if (z <= 1.2e-8) {
tmp = x - (y * a);
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -2.5e+71: tmp = x - a elif z <= 1.2e-8: tmp = x - (y * a) else: tmp = x - a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.5e+71) tmp = Float64(x - a); elseif (z <= 1.2e-8) 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 <= -2.5e+71) tmp = x - a; elseif (z <= 1.2e-8) tmp = x - (y * a); else tmp = x - a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.5e+71], N[(x - a), $MachinePrecision], If[LessEqual[z, 1.2e-8], N[(x - N[(y * a), $MachinePrecision]), $MachinePrecision], N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.5 \cdot 10^{+71}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 1.2 \cdot 10^{-8}:\\
\;\;\;\;x - y \cdot a\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -2.49999999999999986e71 or 1.19999999999999999e-8 < z Initial program 97.8%
associate-/r/100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in z around inf 82.5%
if -2.49999999999999986e71 < z < 1.19999999999999999e-8Initial program 99.2%
associate-/r/99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in z around 0 84.8%
Taylor expanded in t around 0 63.8%
*-commutative63.8%
Simplified63.8%
Final simplification70.7%
(FPCore (x y z t a) :precision binary64 (if (<= z -2.4e+52) (- x a) (if (<= z 9.6e-13) x (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.4e+52) {
tmp = x - a;
} else if (z <= 9.6e-13) {
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 <= (-2.4d+52)) then
tmp = x - a
else if (z <= 9.6d-13) 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 <= -2.4e+52) {
tmp = x - a;
} else if (z <= 9.6e-13) {
tmp = x;
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -2.4e+52: tmp = x - a elif z <= 9.6e-13: tmp = x else: tmp = x - a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.4e+52) tmp = Float64(x - a); elseif (z <= 9.6e-13) 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 <= -2.4e+52) tmp = x - a; elseif (z <= 9.6e-13) tmp = x; else tmp = x - a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.4e+52], N[(x - a), $MachinePrecision], If[LessEqual[z, 9.6e-13], x, N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.4 \cdot 10^{+52}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 9.6 \cdot 10^{-13}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -2.4e52 or 9.5999999999999995e-13 < z Initial program 97.9%
associate-/r/99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in z around inf 81.5%
if -2.4e52 < z < 9.5999999999999995e-13Initial program 99.2%
associate-/r/99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in x around inf 51.4%
Final simplification63.2%
(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 98.7%
associate-/r/99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in x around inf 50.4%
Final simplification50.4%
(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 2023274
(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))))