
(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 (fma (/ (- y z) (+ -1.0 (- z t))) a x))
double code(double x, double y, double z, double t, double a) {
return fma(((y - z) / (-1.0 + (z - t))), a, x);
}
function code(x, y, z, t, a) return fma(Float64(Float64(y - z) / Float64(-1.0 + Float64(z - t))), a, x) end
code[x_, y_, z_, t_, a_] := N[(N[(N[(y - z), $MachinePrecision] / N[(-1.0 + N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{y - z}{-1 + \left(z - t\right)}, a, x\right)
\end{array}
Initial program 96.5%
sub-neg96.5%
+-commutative96.5%
associate-/r/99.6%
distribute-lft-neg-in99.6%
fma-define99.6%
distribute-neg-frac299.6%
distribute-neg-in99.6%
sub-neg99.6%
distribute-neg-in99.6%
remove-double-neg99.6%
+-commutative99.6%
sub-neg99.6%
metadata-eval99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -5.5e+114) (not (<= t 2.9e+69))) (+ x (* a (/ (- z y) t))) (+ x (* a (/ (- y z) (+ z -1.0))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -5.5e+114) || !(t <= 2.9e+69)) {
tmp = x + (a * ((z - y) / t));
} else {
tmp = x + (a * ((y - 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 ((t <= (-5.5d+114)) .or. (.not. (t <= 2.9d+69))) then
tmp = x + (a * ((z - y) / t))
else
tmp = x + (a * ((y - 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 ((t <= -5.5e+114) || !(t <= 2.9e+69)) {
tmp = x + (a * ((z - y) / t));
} else {
tmp = x + (a * ((y - z) / (z + -1.0)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -5.5e+114) or not (t <= 2.9e+69): tmp = x + (a * ((z - y) / t)) else: tmp = x + (a * ((y - z) / (z + -1.0))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -5.5e+114) || !(t <= 2.9e+69)) tmp = Float64(x + Float64(a * Float64(Float64(z - y) / t))); else tmp = Float64(x + Float64(a * Float64(Float64(y - z) / Float64(z + -1.0)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -5.5e+114) || ~((t <= 2.9e+69))) tmp = x + (a * ((z - y) / t)); else tmp = x + (a * ((y - z) / (z + -1.0))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -5.5e+114], N[Not[LessEqual[t, 2.9e+69]], $MachinePrecision]], N[(x + N[(a * N[(N[(z - y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(a * N[(N[(y - z), $MachinePrecision] / N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5.5 \cdot 10^{+114} \lor \neg \left(t \leq 2.9 \cdot 10^{+69}\right):\\
\;\;\;\;x + a \cdot \frac{z - y}{t}\\
\mathbf{else}:\\
\;\;\;\;x + a \cdot \frac{y - z}{z + -1}\\
\end{array}
\end{array}
if t < -5.5000000000000001e114 or 2.8999999999999998e69 < t Initial program 97.5%
associate-/r/98.8%
Simplified98.8%
Taylor expanded in t around inf 93.9%
if -5.5000000000000001e114 < t < 2.8999999999999998e69Initial program 96.0%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in t around 0 95.6%
Final simplification95.1%
(FPCore (x y z t a)
:precision binary64
(if (<= z -2.1e+21)
(+ x (/ (- y z) (/ z a)))
(if (<= z 1.7e+81)
(+ x (* a (/ y (- -1.0 t))))
(+ x (* y (- (/ a z) (/ a y)))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.1e+21) {
tmp = x + ((y - z) / (z / a));
} else if (z <= 1.7e+81) {
tmp = x + (a * (y / (-1.0 - t)));
} else {
tmp = x + (y * ((a / z) - (a / y)));
}
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.1d+21)) then
tmp = x + ((y - z) / (z / a))
else if (z <= 1.7d+81) then
tmp = x + (a * (y / ((-1.0d0) - t)))
else
tmp = x + (y * ((a / z) - (a / y)))
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.1e+21) {
tmp = x + ((y - z) / (z / a));
} else if (z <= 1.7e+81) {
tmp = x + (a * (y / (-1.0 - t)));
} else {
tmp = x + (y * ((a / z) - (a / y)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -2.1e+21: tmp = x + ((y - z) / (z / a)) elif z <= 1.7e+81: tmp = x + (a * (y / (-1.0 - t))) else: tmp = x + (y * ((a / z) - (a / y))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.1e+21) tmp = Float64(x + Float64(Float64(y - z) / Float64(z / a))); elseif (z <= 1.7e+81) tmp = Float64(x + Float64(a * Float64(y / Float64(-1.0 - t)))); else tmp = Float64(x + Float64(y * Float64(Float64(a / z) - Float64(a / y)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -2.1e+21) tmp = x + ((y - z) / (z / a)); elseif (z <= 1.7e+81) tmp = x + (a * (y / (-1.0 - t))); else tmp = x + (y * ((a / z) - (a / y))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.1e+21], N[(x + N[(N[(y - z), $MachinePrecision] / N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.7e+81], N[(x + N[(a * N[(y / N[(-1.0 - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(N[(a / z), $MachinePrecision] - N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.1 \cdot 10^{+21}:\\
\;\;\;\;x + \frac{y - z}{\frac{z}{a}}\\
\mathbf{elif}\;z \leq 1.7 \cdot 10^{+81}:\\
\;\;\;\;x + a \cdot \frac{y}{-1 - t}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(\frac{a}{z} - \frac{a}{y}\right)\\
\end{array}
\end{array}
if z < -2.1e21Initial program 92.1%
Taylor expanded in z around inf 83.3%
associate-*r/83.3%
neg-mul-183.3%
Simplified83.3%
if -2.1e21 < z < 1.70000000000000001e81Initial program 99.8%
associate-/r/99.3%
Simplified99.3%
Taylor expanded in z around 0 93.0%
if 1.70000000000000001e81 < z Initial program 90.8%
Taylor expanded in z around inf 88.1%
associate-*r/88.1%
neg-mul-188.1%
Simplified88.1%
Taylor expanded in y around inf 89.3%
mul-1-neg89.3%
+-commutative89.3%
unsub-neg89.3%
Simplified89.3%
Final simplification90.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.6e+21) (not (<= z 3.6e+15))) (+ x (/ (- y z) (/ z a))) (+ x (* a (/ y (- -1.0 t))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.6e+21) || !(z <= 3.6e+15)) {
tmp = x + ((y - z) / (z / a));
} else {
tmp = x + (a * (y / (-1.0 - t)));
}
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+21)) .or. (.not. (z <= 3.6d+15))) then
tmp = x + ((y - z) / (z / a))
else
tmp = x + (a * (y / ((-1.0d0) - t)))
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+21) || !(z <= 3.6e+15)) {
tmp = x + ((y - z) / (z / a));
} else {
tmp = x + (a * (y / (-1.0 - t)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.6e+21) or not (z <= 3.6e+15): tmp = x + ((y - z) / (z / a)) else: tmp = x + (a * (y / (-1.0 - t))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.6e+21) || !(z <= 3.6e+15)) tmp = Float64(x + Float64(Float64(y - z) / Float64(z / a))); else tmp = Float64(x + Float64(a * Float64(y / Float64(-1.0 - t)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -1.6e+21) || ~((z <= 3.6e+15))) tmp = x + ((y - z) / (z / a)); else tmp = x + (a * (y / (-1.0 - t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.6e+21], N[Not[LessEqual[z, 3.6e+15]], $MachinePrecision]], N[(x + N[(N[(y - z), $MachinePrecision] / N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(a * N[(y / N[(-1.0 - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.6 \cdot 10^{+21} \lor \neg \left(z \leq 3.6 \cdot 10^{+15}\right):\\
\;\;\;\;x + \frac{y - z}{\frac{z}{a}}\\
\mathbf{else}:\\
\;\;\;\;x + a \cdot \frac{y}{-1 - t}\\
\end{array}
\end{array}
if z < -1.6e21 or 3.6e15 < z Initial program 92.4%
Taylor expanded in z around inf 83.8%
associate-*r/83.8%
neg-mul-183.8%
Simplified83.8%
if -1.6e21 < z < 3.6e15Initial program 99.8%
associate-/r/99.3%
Simplified99.3%
Taylor expanded in z around 0 95.1%
Final simplification90.1%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -9.5e+80) (not (<= z 1.7e+81))) (- x a) (+ x (* a (/ y (- -1.0 t))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -9.5e+80) || !(z <= 1.7e+81)) {
tmp = x - a;
} else {
tmp = x + (a * (y / (-1.0 - t)));
}
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.5d+80)) .or. (.not. (z <= 1.7d+81))) then
tmp = x - a
else
tmp = x + (a * (y / ((-1.0d0) - t)))
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.5e+80) || !(z <= 1.7e+81)) {
tmp = x - a;
} else {
tmp = x + (a * (y / (-1.0 - t)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -9.5e+80) or not (z <= 1.7e+81): tmp = x - a else: tmp = x + (a * (y / (-1.0 - t))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -9.5e+80) || !(z <= 1.7e+81)) tmp = Float64(x - a); else tmp = Float64(x + Float64(a * Float64(y / Float64(-1.0 - t)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -9.5e+80) || ~((z <= 1.7e+81))) tmp = x - a; else tmp = x + (a * (y / (-1.0 - t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -9.5e+80], N[Not[LessEqual[z, 1.7e+81]], $MachinePrecision]], N[(x - a), $MachinePrecision], N[(x + N[(a * N[(y / N[(-1.0 - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.5 \cdot 10^{+80} \lor \neg \left(z \leq 1.7 \cdot 10^{+81}\right):\\
\;\;\;\;x - a\\
\mathbf{else}:\\
\;\;\;\;x + a \cdot \frac{y}{-1 - t}\\
\end{array}
\end{array}
if z < -9.499999999999999e80 or 1.70000000000000001e81 < z Initial program 90.9%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in z around inf 80.7%
if -9.499999999999999e80 < z < 1.70000000000000001e81Initial program 99.8%
associate-/r/99.3%
Simplified99.3%
Taylor expanded in z around 0 92.2%
Final simplification88.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.02e+21) (not (<= z 1.66e+109))) (- x a) (- x (* a (/ y t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.02e+21) || !(z <= 1.66e+109)) {
tmp = x - a;
} else {
tmp = x - (a * (y / t));
}
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.02d+21)) .or. (.not. (z <= 1.66d+109))) then
tmp = x - a
else
tmp = x - (a * (y / t))
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.02e+21) || !(z <= 1.66e+109)) {
tmp = x - a;
} else {
tmp = x - (a * (y / t));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.02e+21) or not (z <= 1.66e+109): tmp = x - a else: tmp = x - (a * (y / t)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.02e+21) || !(z <= 1.66e+109)) tmp = Float64(x - a); else tmp = Float64(x - Float64(a * Float64(y / t))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -1.02e+21) || ~((z <= 1.66e+109))) tmp = x - a; else tmp = x - (a * (y / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.02e+21], N[Not[LessEqual[z, 1.66e+109]], $MachinePrecision]], N[(x - a), $MachinePrecision], N[(x - N[(a * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.02 \cdot 10^{+21} \lor \neg \left(z \leq 1.66 \cdot 10^{+109}\right):\\
\;\;\;\;x - a\\
\mathbf{else}:\\
\;\;\;\;x - a \cdot \frac{y}{t}\\
\end{array}
\end{array}
if z < -1.02e21 or 1.6599999999999999e109 < z Initial program 90.9%
associate-/r/100.0%
Simplified100.0%
Taylor expanded in z around inf 83.8%
if -1.02e21 < z < 1.6599999999999999e109Initial program 99.8%
associate-/r/99.3%
Simplified99.3%
Taylor expanded in t around inf 68.5%
Taylor expanded in y around inf 66.9%
Final simplification73.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -9e+21) (not (<= z 3400000000000.0))) (- x a) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -9e+21) || !(z <= 3400000000000.0)) {
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 <= (-9d+21)) .or. (.not. (z <= 3400000000000.0d0))) 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 <= -9e+21) || !(z <= 3400000000000.0)) {
tmp = x - a;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -9e+21) or not (z <= 3400000000000.0): tmp = x - a else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -9e+21) || !(z <= 3400000000000.0)) 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 <= -9e+21) || ~((z <= 3400000000000.0))) tmp = x - a; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -9e+21], N[Not[LessEqual[z, 3400000000000.0]], $MachinePrecision]], N[(x - a), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9 \cdot 10^{+21} \lor \neg \left(z \leq 3400000000000\right):\\
\;\;\;\;x - a\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -9e21 or 3.4e12 < z Initial program 92.4%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in z around inf 77.3%
if -9e21 < z < 3.4e12Initial program 99.8%
sub-neg99.8%
+-commutative99.8%
associate-/r/99.3%
distribute-lft-neg-in99.3%
fma-define99.3%
distribute-neg-frac299.3%
distribute-neg-in99.3%
sub-neg99.3%
distribute-neg-in99.3%
remove-double-neg99.3%
+-commutative99.3%
sub-neg99.3%
metadata-eval99.3%
Simplified99.3%
Taylor expanded in t around inf 61.9%
Final simplification68.8%
(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 96.5%
associate-/r/99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -3.1e+202) (not (<= a 1.28e+129))) (- a) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -3.1e+202) || !(a <= 1.28e+129)) {
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 <= (-3.1d+202)) .or. (.not. (a <= 1.28d+129))) 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 <= -3.1e+202) || !(a <= 1.28e+129)) {
tmp = -a;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -3.1e+202) or not (a <= 1.28e+129): tmp = -a else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -3.1e+202) || !(a <= 1.28e+129)) tmp = Float64(-a); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -3.1e+202) || ~((a <= 1.28e+129))) tmp = -a; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -3.1e+202], N[Not[LessEqual[a, 1.28e+129]], $MachinePrecision]], (-a), x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -3.1 \cdot 10^{+202} \lor \neg \left(a \leq 1.28 \cdot 10^{+129}\right):\\
\;\;\;\;-a\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -3.09999999999999991e202 or 1.27999999999999994e129 < a Initial program 99.7%
associate-/r/97.7%
Simplified97.7%
Taylor expanded in z around inf 34.3%
Taylor expanded in x around 0 33.6%
neg-mul-133.6%
Simplified33.6%
if -3.09999999999999991e202 < a < 1.27999999999999994e129Initial program 95.8%
sub-neg95.8%
+-commutative95.8%
associate-/r/99.9%
distribute-lft-neg-in99.9%
fma-define99.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 t around inf 64.9%
Final simplification59.4%
(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.5%
sub-neg96.5%
+-commutative96.5%
associate-/r/99.6%
distribute-lft-neg-in99.6%
fma-define99.6%
distribute-neg-frac299.6%
distribute-neg-in99.6%
sub-neg99.6%
distribute-neg-in99.6%
remove-double-neg99.6%
+-commutative99.6%
sub-neg99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in t around inf 55.0%
(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 2024146
(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))))