|
From: Stavros M. (Σ. Μ. <mac...@al...> - 2016-01-27 01:08:13
|
Extending float so that float(exp(10000)) returns a bfloat is cute, but I'm not convinced it is a good idea. Consider the following cases: * float(10^500) gives an error, not 1.0b500 -- this is presumably just a banal oversight, not a conceptual problem * float(exp(1000)) conveniently catches the overflow, and returns 1.9b434. But float(exp(-1000)) does not catch the underflow, and returns the float 0.0. * float( 1/(1+exp(1000)) - exp(-1000) ) returns 5.1b-435. But bfloat( 1/(1+exp(1000)) - exp(-1000) ) returns 0.0b0 with default fpprec (with fpprec=1000, you get -2.6b-869). * float((%e^-35+1)*%e^1000-%e^1000) => 1.31b419, but bfloat(...) => 1.25b419. So what exactly does float(...) mean? It no longer means "the result as calculated in floating point arithmetic", nor does it mean "the result as calculated with bfloat arithmetic and thus bfloat accuracy". On Tue, Jan 26, 2016 at 1:11 PM, Raymond Toy <toy...@gm...> wrote: > >>>>> "Richard" == Richard Fateman <fa...@be...> writes: > > Richard> On 1/26/2016 1:44 AM, David Scherfgen wrote: > >> Hello, > >> > >> I'm getting very weird and inconsistent behavior when doing > >> float(exp(10000)) vs. float(exp(10000/3)) and float(exp(10000.0)). > >> > >> The first one works - the result is promoted to bigfloat. > Richard> This is a hack, and I suppose previously it overflowed. > float() used to > Richard> convert to double-float machine > Richard> precision. Someone changed it to upgrade to bigfloat, i.e. > make it the > Richard> same as bfloat() when needed. > > Yes, this is a recent addition. I never really liked it because you > can get a bfloat by using bfloat(). > > >> The third one gives an error. > Richard> I think this one fails because exp(10000.0) overflows > before float() > Richard> sees it. > Richard> Not a bug? > > I agree. It's not a bug because you're explicitly asking for > exp(10000.0). But perhaps those in favor of returning a bigfloat in > the other cases will see this a a bug too. > > -- > Ray > > > > ------------------------------------------------------------------------------ > Site24x7 APM Insight: Get Deep Visibility into Application Performance > APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month > Monitor end-to-end web transactions and take corrective actions now > Troubleshoot faster and improve end-user experience. Signup Now! > http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140 > _______________________________________________ > Maxima-discuss mailing list > Max...@li... > https://lists.sourceforge.net/lists/listinfo/maxima-discuss > |