Re: Floating point subtraction rounding error (NOT display error)

2007-12-14 Thread J. Robertson
Keflavich wrote: > [snip] > > I feel fairly certain, however, that floats are exactly what I want > for my purposes: I need moderately high precision and I'm not > concerned about the least-significant-bit errors except when they > violate function domains. I guess the overriding lesson is that e

Re: Floating point subtraction rounding error (NOT display error)

2007-12-14 Thread Keflavich
On Dec 14, 8:28 am, Carl Banks <[EMAIL PROTECTED]> wrote: > On Dec 13, 6:20 pm, Keflavich <[EMAIL PROTECTED]> wrote: > > > Solved: used round(number,12) in this case for all of the operands of > > my arcsines. Not pretty, but at least VIM made it easy... > > > Thanks for the help, > > Adam > > I s

Re: Floating point subtraction rounding error (NOT display error)

2007-12-14 Thread Carl Banks
On Dec 13, 6:20 pm, Keflavich <[EMAIL PROTECTED]> wrote: > Solved: used round(number,12) in this case for all of the operands of > my arcsines. Not pretty, but at least VIM made it easy... > > Thanks for the help, > Adam I suspect this could even fail in some circumstances. If it's for school yo

Re: Floating point subtraction rounding error (NOT display error)

2007-12-14 Thread Keflavich
On Dec 14, 2:57 am, "Nikos Vergas" <[EMAIL PROTECTED]> wrote: > > Solved: used round(number,12) in this case for all of the operands of > > my arcsines. Not pretty, but at least VIM made it easy... > > You might have the same problem though: > > >>> round(1.0003401032523500235,13) > 1.0003

Re: Floating point subtraction rounding error (NOT display error)

2007-12-14 Thread Gabriel Genellina
En Fri, 14 Dec 2007 00:22:18 -0300, Keflavich <[EMAIL PROTECTED]> escribió: > On Dec 13, 5:52 pm, Steven D'Aprano <[EMAIL PROTECTED] > cybersource.com.au> wrote: >> On Thu, 13 Dec 2007 14:30:18 -0800, Keflavich wrote: >> > Hey, I have a bit of code that died on a domain error when doing an >> >

Re: Floating point subtraction rounding error (NOT display error)

2007-12-14 Thread Nikos Vergas
> Solved: used round(number,12) in this case for all of the operands of > my arcsines. Not pretty, but at least VIM made it easy... You might have the same problem though: >>> round(1.0003401032523500235,13) 1.000340103 >>> round(1.0003401032523500235,12) 1.00034011 -

Re: Floating point subtraction rounding error (NOT display error)

2007-12-13 Thread Paddy
On Dec 14, 3:22 am, Keflavich <[EMAIL PROTECTED]> wrote: > On Dec 13, 5:52 pm, Steven D'Aprano <[EMAIL PROTECTED] > > cybersource.com.au> wrote: > > On Thu, 13 Dec 2007 14:30:18 -0800, Keflavich wrote: > > > Hey, I have a bit of code that died on a domain error when doing an > > > arcsin, and appar

Re: Floating point subtraction rounding error (NOT display error)

2007-12-13 Thread Keflavich
On Dec 13, 5:52 pm, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Thu, 13 Dec 2007 14:30:18 -0800, Keflavich wrote: > > Hey, I have a bit of code that died on a domain error when doing an > > arcsin, and apparently it's because floating point subtraction is having > > problems.

Re: Floating point subtraction rounding error (NOT display error)

2007-12-13 Thread Steven D'Aprano
On Thu, 13 Dec 2007 14:30:18 -0800, Keflavich wrote: > Hey, I have a bit of code that died on a domain error when doing an > arcsin, and apparently it's because floating point subtraction is having > problems. I'm not convinced that your diagnosis is correct. Unless you're using some weird, unco

Re: Floating point subtraction rounding error (NOT display error)

2007-12-13 Thread Keflavich
Solved: used round(number,12) in this case for all of the operands of my arcsines. Not pretty, but at least VIM made it easy... Thanks for the help, Adam On Dec 13, 4:01 pm, Keflavich <[EMAIL PROTECTED]> wrote: > The decimal package isn't what I'm looking for - I don't want to have > to retype

Re: Floating point subtraction rounding error (NOT display error)

2007-12-13 Thread Keflavich
The decimal package isn't what I'm looking for - I don't want to have to retype every variable in my code, and I have arcsines showing up on about a dozen lines right now. It also seems like a rather complicated way to deal with the problem; maybe I just need to implement my own rounding code, but

Re: Floating point subtraction rounding error (NOT display error)

2007-12-13 Thread Keflavich
Thanks, I'll have a look at that. I'm not sure the decimal type is included in numpy, though, which is what I'm using. It doesn't show up in their documentation, at least. Adam On Dec 13, 3:39 pm, [EMAIL PROTECTED] (Aahz) wrote: > In article <[EMAIL PROTECTED]>, > > Keflavich <[EMAIL PROTECTED

Re: Floating point subtraction rounding error (NOT display error)

2007-12-13 Thread Aahz
In article <[EMAIL PROTECTED]>, Keflavich <[EMAIL PROTECTED]> wrote: > >Hey, I have a bit of code that died on a domain error when doing an >arcsin, and apparently it's because floating point subtraction is >having problems. I know about the impossibility of storing floating >point numbers precis

Floating point subtraction rounding error (NOT display error)

2007-12-13 Thread Keflavich
Hey, I have a bit of code that died on a domain error when doing an arcsin, and apparently it's because floating point subtraction is having problems. I know about the impossibility of storing floating point numbers precisely, but I was under the impression that the standard used for that last dig