Re: This calculation is just wrong / computer can't count!

Tech-Archive recommends: Fix windows errors by optimizing your registry



1. Take computational math 101.
2. Adjust your expectations.
3. If you calculate the "same" number using different sequence of
operations, you'll get different result.
4. There is no exact result with floating point. Live with it.

"GT" <ContactGT_remove_@xxxxxxxxxxx> wrote in message
news:0057ac41$0$11709$c3e8da3@xxxxxxxxxxxxxxxxxxxx

We all know computers are binary machines, not decimal, but why can't the
computer do the same basic maths as a pocket calculator?!? 25/30 is
0.833recurring and it should calculate, store and display as many digits
as can be stored at the desired level of granularity, not randomly invent
an extra digit on the end! I repeat my question:

How do I get the computer to calculate and store the number of digits that
it can handle and no more. I don't care if it calculates 6, 10, 15, 27
digits, but I do *require* a correct result 25/30 is *NOT* 0.83337 or
0.8333337 or 0.833333333333333333337. and 0.8333337 + 1 is *NOT* 1.8333335
!!

If the C++ basic data types can't handle this basic mathematics, then how
can we even trust it to do 1+1 etc.



.



Relevant Pages

  • Re: bigint queston C++ classes
    ... I suggest an array of unsigned char, or unsigned short, or perhaps unsigned ... You'll need ceil/log) base-b digits to store x, ... these are not strings, ...
    (comp.programming)
  • Re: bigint queston C++ classes
    ... I suggest an array of unsigned char, or unsigned short, or perhaps unsigned ... routine for turning the end result into base ten for display, ... You'll need ceil/log) base-b digits to store x, ...
    (comp.programming)
  • Re: Parse current IP address into environment variables
    ... environment variable called Store based on its value, ... running your script. ... on the MAC address rather than the last two digits of the last octet of the ...
    (microsoft.public.scripting.vbscript)
  • Re: Fibonacci numbers
    ... | Of course there is the question of how to store the number. ... Instead of using characters to represent decimal digits, ... It is easier than dealing with characters, as you don't need to offset ... the way that we write numbers in strings. ...
    (comp.lang.cpp)
  • Re: large number, store and sort
    ... >of digits rather than a number: ... >If you need to sort on just some of the digits it would ... >digits) means any leading zeroes are automatically ... >>presently planning to store it without spaces). ...
    (microsoft.public.access.tablesdbdesign)