This week's giveaway is in the EJB and other Java EE Technologies forum. We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line! See this thread for details.
Well I don't know what the exact reason for this, but just heard that it is some thing to do with the platform you are running java. But if you want to get rid of this, you can use round(). Hope this helps
SCJP 1.4, SCMAD 1.0<br />SCWCD, SCBCD (in progress)
So, do they teach long division in schools anymore?
The upper row is filled with the anwer to "how many times does the divisor go into the dividend?"
Simple (base 10) example: divide 1421 by 7
7 goes into 1 zero times, so we include the next digit. (We would write a zero in the top line, except that by convention we do not write leading zeros.) Now, 7 goes into 14 once, so we write a 2 above the rightmost digit that we used in the dividend (the 4). Now, we multiply the 2 by the 7 to get 14 and write that below the 1 4 in the dividend. Subtract 14 from 14 and we get a result of 0. Drop the 2 from the dividend down and get 02. 7 goes into 2 zero times, so we we write a zero in the answer (and multiply 0 by 7 to get 0, subtract that from the 2 to get 2) and drop down the 1 to make 21. (Note that the right equation does not physically multiply by zero; it justs writes the zero and drops down the 1). Now, 7 goes into 21 3 times, so we write a 3 and do the same thing. Multiply 3 by 7 to get 21 and write that and subtract, resulting in zero. Now we've used up all numbers, so we check our decimal points (they're in the right places) and return the answer: 203
Stan's did just the same thing, except he used binary, not decimal.
Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.
Joined: Feb 08, 2004
that's how we do it here: 35 / 40 = 0,875
i cant format it but sure can calculate it [ April 25, 2005: Message edited by: miguel lisboa ]
Joined: Jan 29, 2003
Wow, being a cultural bigot it never occurred to me there were other notations. Neat, thanks! BTW: Where is "here" for you?
Oh, and I dug up a computer architecture book with the algorithm for dividing in binary. It's multiplying with two's compliments and takes about three pages to describe in full. I won't be quoting it here because I only understood the first paragraph.