
(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 (/ (- y z) (+ -1.0 (- z t))))))
double code(double x, double y, double z, double t, double a) {
return x + (a * ((y - z) / (-1.0 + (z - t))));
}
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) / ((-1.0d0) + (z - t))))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (a * ((y - z) / (-1.0 + (z - t))));
}
def code(x, y, z, t, a): return x + (a * ((y - z) / (-1.0 + (z - t))))
function code(x, y, z, t, a) return Float64(x + Float64(a * Float64(Float64(y - z) / Float64(-1.0 + Float64(z - t))))) end
function tmp = code(x, y, z, t, a) tmp = x + (a * ((y - z) / (-1.0 + (z - t)))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(a * N[(N[(y - z), $MachinePrecision] / N[(-1.0 + N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + a \cdot \frac{y - z}{-1 + \left(z - t\right)}
\end{array}
Initial program 97.4%
associate-/r/99.2%
Simplified99.2%
Final simplification99.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* a (/ (- z y) t)))))
(if (<= t -7.5e-7)
t_1
(if (<= t -2e-135)
(+ x (/ y (/ (+ z -1.0) a)))
(if (<= t 6.2e+69) (- x (* a (/ z (+ z -1.0)))) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (a * ((z - y) / t));
double tmp;
if (t <= -7.5e-7) {
tmp = t_1;
} else if (t <= -2e-135) {
tmp = x + (y / ((z + -1.0) / a));
} else if (t <= 6.2e+69) {
tmp = x - (a * (z / (z + -1.0)));
} 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 * ((z - y) / t))
if (t <= (-7.5d-7)) then
tmp = t_1
else if (t <= (-2d-135)) then
tmp = x + (y / ((z + (-1.0d0)) / a))
else if (t <= 6.2d+69) then
tmp = x - (a * (z / (z + (-1.0d0))))
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 * ((z - y) / t));
double tmp;
if (t <= -7.5e-7) {
tmp = t_1;
} else if (t <= -2e-135) {
tmp = x + (y / ((z + -1.0) / a));
} else if (t <= 6.2e+69) {
tmp = x - (a * (z / (z + -1.0)));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + (a * ((z - y) / t)) tmp = 0 if t <= -7.5e-7: tmp = t_1 elif t <= -2e-135: tmp = x + (y / ((z + -1.0) / a)) elif t <= 6.2e+69: tmp = x - (a * (z / (z + -1.0))) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(a * Float64(Float64(z - y) / t))) tmp = 0.0 if (t <= -7.5e-7) tmp = t_1; elseif (t <= -2e-135) tmp = Float64(x + Float64(y / Float64(Float64(z + -1.0) / a))); elseif (t <= 6.2e+69) tmp = Float64(x - Float64(a * Float64(z / Float64(z + -1.0)))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + (a * ((z - y) / t)); tmp = 0.0; if (t <= -7.5e-7) tmp = t_1; elseif (t <= -2e-135) tmp = x + (y / ((z + -1.0) / a)); elseif (t <= 6.2e+69) tmp = x - (a * (z / (z + -1.0))); 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[(z - y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -7.5e-7], t$95$1, If[LessEqual[t, -2e-135], N[(x + N[(y / N[(N[(z + -1.0), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 6.2e+69], N[(x - N[(a * N[(z / N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + a \cdot \frac{z - y}{t}\\
\mathbf{if}\;t \leq -7.5 \cdot 10^{-7}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -2 \cdot 10^{-135}:\\
\;\;\;\;x + \frac{y}{\frac{z + -1}{a}}\\
\mathbf{elif}\;t \leq 6.2 \cdot 10^{+69}:\\
\;\;\;\;x - a \cdot \frac{z}{z + -1}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -7.5000000000000002e-7 or 6.1999999999999997e69 < t Initial program 99.2%
associate-/r/98.0%
Simplified98.0%
Taylor expanded in t around inf 84.4%
if -7.5000000000000002e-7 < t < -2.0000000000000001e-135Initial program 99.8%
Taylor expanded in t around 0 99.8%
Taylor expanded in y around inf 92.5%
if -2.0000000000000001e-135 < t < 6.1999999999999997e69Initial program 95.5%
Taylor expanded in t around 0 91.8%
Taylor expanded in y around 0 64.3%
mul-1-neg64.3%
Simplified64.3%
Taylor expanded in a around 0 64.3%
mul-1-neg64.3%
distribute-frac-neg264.3%
associate-*r/78.0%
neg-sub078.0%
associate--r-78.0%
metadata-eval78.0%
Simplified78.0%
Final simplification82.0%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* a (/ (- z y) t)))))
(if (<= t -4100.0)
t_1
(if (<= t -1.45e-138)
(- x (* y a))
(if (<= t 2.15e+70) (- x (* a (/ z (+ z -1.0)))) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (a * ((z - y) / t));
double tmp;
if (t <= -4100.0) {
tmp = t_1;
} else if (t <= -1.45e-138) {
tmp = x - (y * a);
} else if (t <= 2.15e+70) {
tmp = x - (a * (z / (z + -1.0)));
} 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 * ((z - y) / t))
if (t <= (-4100.0d0)) then
tmp = t_1
else if (t <= (-1.45d-138)) then
tmp = x - (y * a)
else if (t <= 2.15d+70) then
tmp = x - (a * (z / (z + (-1.0d0))))
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 * ((z - y) / t));
double tmp;
if (t <= -4100.0) {
tmp = t_1;
} else if (t <= -1.45e-138) {
tmp = x - (y * a);
} else if (t <= 2.15e+70) {
tmp = x - (a * (z / (z + -1.0)));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + (a * ((z - y) / t)) tmp = 0 if t <= -4100.0: tmp = t_1 elif t <= -1.45e-138: tmp = x - (y * a) elif t <= 2.15e+70: tmp = x - (a * (z / (z + -1.0))) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(a * Float64(Float64(z - y) / t))) tmp = 0.0 if (t <= -4100.0) tmp = t_1; elseif (t <= -1.45e-138) tmp = Float64(x - Float64(y * a)); elseif (t <= 2.15e+70) tmp = Float64(x - Float64(a * Float64(z / Float64(z + -1.0)))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + (a * ((z - y) / t)); tmp = 0.0; if (t <= -4100.0) tmp = t_1; elseif (t <= -1.45e-138) tmp = x - (y * a); elseif (t <= 2.15e+70) tmp = x - (a * (z / (z + -1.0))); 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[(z - y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -4100.0], t$95$1, If[LessEqual[t, -1.45e-138], N[(x - N[(y * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.15e+70], N[(x - N[(a * N[(z / N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + a \cdot \frac{z - y}{t}\\
\mathbf{if}\;t \leq -4100:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -1.45 \cdot 10^{-138}:\\
\;\;\;\;x - y \cdot a\\
\mathbf{elif}\;t \leq 2.15 \cdot 10^{+70}:\\
\;\;\;\;x - a \cdot \frac{z}{z + -1}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -4100 or 2.15e70 < t Initial program 99.2%
associate-/r/98.0%
Simplified98.0%
Taylor expanded in t around inf 86.1%
if -4100 < t < -1.44999999999999987e-138Initial program 99.8%
Taylor expanded in t around 0 99.8%
Taylor expanded in z around 0 83.2%
if -1.44999999999999987e-138 < t < 2.15e70Initial program 95.5%
Taylor expanded in t around 0 91.8%
Taylor expanded in y around 0 64.3%
mul-1-neg64.3%
Simplified64.3%
Taylor expanded in a around 0 64.3%
mul-1-neg64.3%
distribute-frac-neg264.3%
associate-*r/78.0%
neg-sub078.0%
associate--r-78.0%
metadata-eval78.0%
Simplified78.0%
Final simplification81.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -1.8e+89) (not (<= t 5.1e+54))) (+ x (* a (/ (- z y) t))) (- x (/ (- z y) (/ (+ z -1.0) a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -1.8e+89) || !(t <= 5.1e+54)) {
tmp = x + (a * ((z - y) / t));
} else {
tmp = x - ((z - y) / ((z + -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 ((t <= (-1.8d+89)) .or. (.not. (t <= 5.1d+54))) then
tmp = x + (a * ((z - y) / t))
else
tmp = x - ((z - y) / ((z + (-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 ((t <= -1.8e+89) || !(t <= 5.1e+54)) {
tmp = x + (a * ((z - y) / t));
} else {
tmp = x - ((z - y) / ((z + -1.0) / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -1.8e+89) or not (t <= 5.1e+54): tmp = x + (a * ((z - y) / t)) else: tmp = x - ((z - y) / ((z + -1.0) / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -1.8e+89) || !(t <= 5.1e+54)) tmp = Float64(x + Float64(a * Float64(Float64(z - y) / t))); else tmp = Float64(x - Float64(Float64(z - y) / Float64(Float64(z + -1.0) / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -1.8e+89) || ~((t <= 5.1e+54))) tmp = x + (a * ((z - y) / t)); else tmp = x - ((z - y) / ((z + -1.0) / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -1.8e+89], N[Not[LessEqual[t, 5.1e+54]], $MachinePrecision]], N[(x + N[(a * N[(N[(z - y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(N[(z - y), $MachinePrecision] / N[(N[(z + -1.0), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.8 \cdot 10^{+89} \lor \neg \left(t \leq 5.1 \cdot 10^{+54}\right):\\
\;\;\;\;x + a \cdot \frac{z - y}{t}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{z - y}{\frac{z + -1}{a}}\\
\end{array}
\end{array}
if t < -1.8e89 or 5.10000000000000009e54 < t Initial program 98.1%
associate-/r/97.9%
Simplified97.9%
Taylor expanded in t around inf 88.6%
if -1.8e89 < t < 5.10000000000000009e54Initial program 97.0%
Taylor expanded in t around 0 92.5%
Final simplification91.2%
(FPCore (x y z t a)
:precision binary64
(if (<= z -3.5e+41)
(- x a)
(if (<= z 0.165)
(+ x (/ (* y a) (- -1.0 t)))
(- x (* a (/ z (+ z -1.0)))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.5e+41) {
tmp = x - a;
} else if (z <= 0.165) {
tmp = x + ((y * a) / (-1.0 - t));
} else {
tmp = x - (a * (z / (z + -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 <= (-3.5d+41)) then
tmp = x - a
else if (z <= 0.165d0) then
tmp = x + ((y * a) / ((-1.0d0) - t))
else
tmp = x - (a * (z / (z + (-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 <= -3.5e+41) {
tmp = x - a;
} else if (z <= 0.165) {
tmp = x + ((y * a) / (-1.0 - t));
} else {
tmp = x - (a * (z / (z + -1.0)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -3.5e+41: tmp = x - a elif z <= 0.165: tmp = x + ((y * a) / (-1.0 - t)) else: tmp = x - (a * (z / (z + -1.0))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -3.5e+41) tmp = Float64(x - a); elseif (z <= 0.165) tmp = Float64(x + Float64(Float64(y * a) / Float64(-1.0 - t))); else tmp = Float64(x - Float64(a * Float64(z / Float64(z + -1.0)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -3.5e+41) tmp = x - a; elseif (z <= 0.165) tmp = x + ((y * a) / (-1.0 - t)); else tmp = x - (a * (z / (z + -1.0))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -3.5e+41], N[(x - a), $MachinePrecision], If[LessEqual[z, 0.165], N[(x + N[(N[(y * a), $MachinePrecision] / N[(-1.0 - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(a * N[(z / N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.5 \cdot 10^{+41}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 0.165:\\
\;\;\;\;x + \frac{y \cdot a}{-1 - t}\\
\mathbf{else}:\\
\;\;\;\;x - a \cdot \frac{z}{z + -1}\\
\end{array}
\end{array}
if z < -3.4999999999999999e41Initial program 94.7%
associate-/r/100.0%
Simplified100.0%
Taylor expanded in z around inf 91.4%
if -3.4999999999999999e41 < z < 0.165000000000000008Initial program 99.8%
associate-/r/98.5%
Simplified98.5%
Taylor expanded in z around 0 89.5%
if 0.165000000000000008 < z Initial program 94.8%
Taylor expanded in t around 0 77.8%
Taylor expanded in y around 0 61.0%
mul-1-neg61.0%
Simplified61.0%
Taylor expanded in a around 0 61.0%
mul-1-neg61.0%
distribute-frac-neg261.0%
associate-*r/77.4%
neg-sub077.4%
associate--r-77.4%
metadata-eval77.4%
Simplified77.4%
Final simplification86.7%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.45e+42) (- x a) (if (<= z 1.15e-16) (- x (* y a)) (- x (* a (/ z (+ z -1.0)))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.45e+42) {
tmp = x - a;
} else if (z <= 1.15e-16) {
tmp = x - (y * a);
} else {
tmp = x - (a * (z / (z + -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.45d+42)) then
tmp = x - a
else if (z <= 1.15d-16) then
tmp = x - (y * a)
else
tmp = x - (a * (z / (z + (-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.45e+42) {
tmp = x - a;
} else if (z <= 1.15e-16) {
tmp = x - (y * a);
} else {
tmp = x - (a * (z / (z + -1.0)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1.45e+42: tmp = x - a elif z <= 1.15e-16: tmp = x - (y * a) else: tmp = x - (a * (z / (z + -1.0))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.45e+42) tmp = Float64(x - a); elseif (z <= 1.15e-16) tmp = Float64(x - Float64(y * a)); else tmp = Float64(x - Float64(a * Float64(z / Float64(z + -1.0)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -1.45e+42) tmp = x - a; elseif (z <= 1.15e-16) tmp = x - (y * a); else tmp = x - (a * (z / (z + -1.0))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.45e+42], N[(x - a), $MachinePrecision], If[LessEqual[z, 1.15e-16], N[(x - N[(y * a), $MachinePrecision]), $MachinePrecision], N[(x - N[(a * N[(z / N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.45 \cdot 10^{+42}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 1.15 \cdot 10^{-16}:\\
\;\;\;\;x - y \cdot a\\
\mathbf{else}:\\
\;\;\;\;x - a \cdot \frac{z}{z + -1}\\
\end{array}
\end{array}
if z < -1.4499999999999999e42Initial program 94.7%
associate-/r/100.0%
Simplified100.0%
Taylor expanded in z around inf 91.4%
if -1.4499999999999999e42 < z < 1.15e-16Initial program 99.8%
Taylor expanded in t around 0 73.0%
Taylor expanded in z around 0 70.8%
if 1.15e-16 < z Initial program 95.1%
Taylor expanded in t around 0 77.7%
Taylor expanded in y around 0 61.8%
mul-1-neg61.8%
Simplified61.8%
Taylor expanded in a around 0 61.8%
mul-1-neg61.8%
distribute-frac-neg261.8%
associate-*r/77.2%
neg-sub077.2%
associate--r-77.2%
metadata-eval77.2%
Simplified77.2%
Final simplification77.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -2.4e+41) (not (<= z 1.35e-16))) (- x a) (- x (* y a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -2.4e+41) || !(z <= 1.35e-16)) {
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 <= (-2.4d+41)) .or. (.not. (z <= 1.35d-16))) 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 <= -2.4e+41) || !(z <= 1.35e-16)) {
tmp = x - a;
} else {
tmp = x - (y * a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -2.4e+41) or not (z <= 1.35e-16): tmp = x - a else: tmp = x - (y * a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -2.4e+41) || !(z <= 1.35e-16)) 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 <= -2.4e+41) || ~((z <= 1.35e-16))) tmp = x - a; else tmp = x - (y * a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -2.4e+41], N[Not[LessEqual[z, 1.35e-16]], $MachinePrecision]], N[(x - a), $MachinePrecision], N[(x - N[(y * a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.4 \cdot 10^{+41} \lor \neg \left(z \leq 1.35 \cdot 10^{-16}\right):\\
\;\;\;\;x - a\\
\mathbf{else}:\\
\;\;\;\;x - y \cdot a\\
\end{array}
\end{array}
if z < -2.4000000000000002e41 or 1.35e-16 < z Initial program 94.9%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in z around inf 82.6%
if -2.4000000000000002e41 < z < 1.35e-16Initial program 99.8%
Taylor expanded in t around 0 73.0%
Taylor expanded in z around 0 70.8%
Final simplification76.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -2.4e+41) (not (<= z 8.2e-20))) (- x a) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -2.4e+41) || !(z <= 8.2e-20)) {
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 <= (-2.4d+41)) .or. (.not. (z <= 8.2d-20))) 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 <= -2.4e+41) || !(z <= 8.2e-20)) {
tmp = x - a;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -2.4e+41) or not (z <= 8.2e-20): tmp = x - a else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -2.4e+41) || !(z <= 8.2e-20)) 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 <= -2.4e+41) || ~((z <= 8.2e-20))) tmp = x - a; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -2.4e+41], N[Not[LessEqual[z, 8.2e-20]], $MachinePrecision]], N[(x - a), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.4 \cdot 10^{+41} \lor \neg \left(z \leq 8.2 \cdot 10^{-20}\right):\\
\;\;\;\;x - a\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -2.4000000000000002e41 or 8.2000000000000002e-20 < z Initial program 95.0%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in z around inf 82.0%
if -2.4000000000000002e41 < z < 8.2000000000000002e-20Initial program 99.8%
sub-neg99.8%
+-commutative99.8%
associate-/r/98.5%
distribute-rgt-neg-in98.5%
associate-*l/97.0%
associate-/l*99.9%
fma-define99.9%
distribute-frac-neg99.9%
distribute-neg-frac299.9%
distribute-neg-in99.9%
sub-neg99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
+-commutative99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in a around 0 54.6%
Final simplification68.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -1.6e+120) (not (<= a 1e+48))) (- a) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -1.6e+120) || !(a <= 1e+48)) {
tmp = -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 ((a <= (-1.6d+120)) .or. (.not. (a <= 1d+48))) then
tmp = -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 ((a <= -1.6e+120) || !(a <= 1e+48)) {
tmp = -a;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -1.6e+120) or not (a <= 1e+48): tmp = -a else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -1.6e+120) || !(a <= 1e+48)) tmp = Float64(-a); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -1.6e+120) || ~((a <= 1e+48))) tmp = -a; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -1.6e+120], N[Not[LessEqual[a, 1e+48]], $MachinePrecision]], (-a), x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.6 \cdot 10^{+120} \lor \neg \left(a \leq 10^{+48}\right):\\
\;\;\;\;-a\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -1.59999999999999991e120 or 1.00000000000000004e48 < a Initial program 99.8%
associate-/r/98.0%
Simplified98.0%
Taylor expanded in z around inf 41.8%
Taylor expanded in x around 0 34.8%
neg-mul-134.8%
Simplified34.8%
if -1.59999999999999991e120 < a < 1.00000000000000004e48Initial program 96.0%
sub-neg96.0%
+-commutative96.0%
associate-/r/99.9%
distribute-rgt-neg-in99.9%
associate-*l/99.9%
associate-/l*96.3%
fma-define96.3%
distribute-frac-neg96.3%
distribute-neg-frac296.3%
distribute-neg-in96.3%
sub-neg96.3%
distribute-neg-in96.3%
remove-double-neg96.3%
+-commutative96.3%
sub-neg96.3%
metadata-eval96.3%
Simplified96.3%
Taylor expanded in a around 0 70.1%
Final simplification57.0%
(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 97.4%
sub-neg97.4%
+-commutative97.4%
associate-/r/99.2%
distribute-rgt-neg-in99.2%
associate-*l/86.4%
associate-/l*97.6%
fma-define97.6%
distribute-frac-neg97.6%
distribute-neg-frac297.6%
distribute-neg-in97.6%
sub-neg97.6%
distribute-neg-in97.6%
remove-double-neg97.6%
+-commutative97.6%
sub-neg97.6%
metadata-eval97.6%
Simplified97.6%
Taylor expanded in a around 0 51.2%
(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 2024165
(FPCore (x y z t a)
:name "Graphics.Rendering.Chart.SparkLine:renderSparkLine from Chart-1.5.3"
:precision binary64
:alt
(! :herbie-platform default (- x (* (/ (- y z) (+ (- t z) 1)) a)))
(- x (/ (- y z) (/ (+ (- t z) 1.0) a))))