|
Prev: create vector with index base 1
Next: Hidden window
From: George on 23 Apr 2008 00:43 Hello everyone, If a and b are both float (or double, I think it does not matter?), and I want to calculate a/b. I am wondering whether there will be any issues which make the calculation result in-accurate compared with the calculation result by-hand (on a paper). :-) For example, if a is too big, or if b is too small? If such issue exists, what is the best practices to calculate a/b? thanks in advance, George
From: Carl Daniel [VC++ MVP] on 23 Apr 2008 01:15 George wrote: > Hello everyone, > > > If a and b are both float (or double, I think it does not matter?), > and I want to calculate a/b. I am wondering whether there will be any > issues which make the calculation result in-accurate compared with > the calculation result by-hand (on a paper). :-) > > For example, if a is too big, or if b is too small? If such issue > exists, what is the best practices to calculate a/b? http://www.physics.ohio-state.edu/~dws/grouplinks/floating_point_math.pdf http://docs.sun.com/source/806-3568/ncg_goldberg.html Both of these links are to different versions of the same document. Read it. Understand it. -cd
From: George on 23 Apr 2008 02:30 Good reference, thanks cd! regards, George "Carl Daniel [VC++ MVP]" wrote: > George wrote: > > Hello everyone, > > > > > > If a and b are both float (or double, I think it does not matter?), > > and I want to calculate a/b. I am wondering whether there will be any > > issues which make the calculation result in-accurate compared with > > the calculation result by-hand (on a paper). :-) > > > > For example, if a is too big, or if b is too small? If such issue > > exists, what is the best practices to calculate a/b? > > http://www.physics.ohio-state.edu/~dws/grouplinks/floating_point_math.pdf > http://docs.sun.com/source/806-3568/ncg_goldberg.html > > Both of these links are to different versions of the same document. Read > it. Understand it. > > -cd > > >
|
Pages: 1 Prev: create vector with index base 1 Next: Hidden window |