Re: This calculation is just wrong / computer can't count!
- From: "GT" <ContactGT_remove_@xxxxxxxxxxx>
- Date: Fri, 5 Oct 2007 17:01:49 +0100
".rhavin grobert" <clqrq@xxxxxxxx> wrote in message
news:1191599292.427080.100770@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
On 5 Okt., 11:38, "GT" <ContactGT_remo...@xxxxxxxxxxx> wrote:
I would like to know how to use the basic C++ datatypes and where the
last
digit is 'wrong' or 'unreliable', just don't use it. Everyone keeps
saying
'just use the digits you can rely on', but how? I have a double
effortChangeProportion which has 15 or 16 decimal places. HOW do I tell
it
to just use the first 10 decimal places, thereby dropping the final digit
which is knocking out my calculations? I can't find any methods on a
double
which tell it to truncate digits.
You cant tell yout computer "drop the last x digits in decimal system"if you're interested in the last 5 digits of 0.444444443094876 _as a
when your number is stored in BINARY.
number_ then you should do a
int iResult = (0.444444443094876 * 10000);
then do the rest of your calculation and divide by 10000 at the end
(according to your function you of course may do more than this).
Thanks, but I have tried this, but the divide by 10000 then re-introduces an
erroneous digit on the end of the number, so gains me nothing!
if you're interested in the last 5 digits of 0.444444443094876 _as a
string_ then you should simply do a
CString str;
str.Format("%.5f", 0.444444443094876 );
rhavin;)
.
- Follow-Ups:
- Re: This calculation is just wrong / computer can't count!
- From: Joseph M . Newcomer
- Re: This calculation is just wrong / computer can't count!
- From: .rhavin grobert
- Re: This calculation is just wrong / computer can't count!
- References:
- This calculation is just wrong / computer can't count!
- From: GT
- Re: This calculation is just wrong / computer can't count!
- From: AliR \(VC++ MVP\)
- Re: This calculation is just wrong / computer can't count!
- From: GT
- Re: This calculation is just wrong / computer can't count!
- From: Les
- Re: This calculation is just wrong / computer can't count!
- From: GT
- Re: This calculation is just wrong / computer can't count!
- From: Les
- Re: This calculation is just wrong / computer can't count!
- From: GT
- Re: This calculation is just wrong / computer can't count!
- From: Les
- Re: This calculation is just wrong / computer can't count!
- From: GT
- Re: This calculation is just wrong / computer can't count!
- From: .rhavin grobert
- This calculation is just wrong / computer can't count!
- Prev by Date: Re: This calculation is just wrong / computer can't count!
- Next by Date: Re: This calculation is just wrong / computer can't count!
- Previous by thread: Re: This calculation is just wrong / computer can't count!
- Next by thread: Re: This calculation is just wrong / computer can't count!
- Index(es):
Relevant Pages
|