BrowserUk has asked for the wisdom of the Perl Monks concerning the following question:
Can anyone figure out why, given all the additions and subtractions involving doubles, going on in the following method; the only one wrapped in double( ) is the last one?
BTW: members lo & hi are both doubles. And the full source code is here.
inline doubledouble operator +(const doubledouble& x, const doubledoub +le& y) { double H, h, T, t, S, s, e, f; S = x.hi + y.hi; T = x.lo + y.lo; e = S - x.hi; f = T - x.lo; s = S - e; t = T - f; s = ( y.hi - e ) + ( x.hi - s); t = ( y.lo - f ) + ( x.lo - t ); e = s + T; H = S + e; h = e + ( S - H ); e = t + h; doubledouble z; z.hi = H + e; z.lo = e + double( H - z.hi ); return z; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: [OT] C++ mystery.
by roboticus (Chancellor) on Jun 19, 2015 at 19:00 UTC | |
by BrowserUk (Patriarch) on Jun 19, 2015 at 19:44 UTC | |
by Anonymous Monk on Jun 19, 2015 at 19:48 UTC | |
by BrowserUk (Patriarch) on Jun 19, 2015 at 20:35 UTC | |
by bitingduck (Deacon) on Jun 20, 2015 at 00:46 UTC | |
by BrowserUk (Patriarch) on Jun 20, 2015 at 01:15 UTC | |
|