Results 1 to 4 of 4
Thread: Dividing numbers
- 07-31-2012, 01:00 PM #1
Member
- Join Date
- Jul 2012
- Posts
- 1
- Rep Power
- 0
Dividing numbers
Right, I am kind of sorry for bothering you guys with a beginner question like this, but I cannot get over this relatively simple problem.
So, I have this number, lets say, 12345678 and I want to turn it into number 12,3456789. How do I do that? 12345678/1000000 outputs 12.Last edited by Pootis; 07-31-2012 at 01:02 PM.
- 07-31-2012, 01:09 PM #2
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,408
- Blog Entries
- 7
- Rep Power
- 17
Re: Dividing numbers
That's how integer division works: it throws away any fraction (digits right of the decimal point); if at least one of the operands isn't an int, 'normal' division is applied; (hint 1000000.0 isn't an int).
kind regards,
JosWhen people rob a bank they get a penalty; when banks rob people they get a bonus.
- 07-31-2012, 01:18 PM #3
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
Re: Dividing numbers
1000000.0
Without that it is treated as integer division, which gives an integer result.Please do not ask for code as refusal often offends.
- 07-31-2012, 01:19 PM #4
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
Similar Threads
-
Dividing in java
By poop in forum New To JavaReplies: 4Last Post: 05-30-2011, 07:56 AM -
Dividing in Java
By hawaiifiver in forum New To JavaReplies: 19Last Post: 03-11-2011, 11:09 AM -
Dividing 3 items, please help.
By Quizzle23 in forum New To JavaReplies: 18Last Post: 02-24-2011, 06:42 AM -
Trying to store a decimal between 0&1 after dividing by 100
By jebbo in forum New To JavaReplies: 2Last Post: 10-28-2010, 01:56 PM -
Dividing numbers with remainders showing
By denisdoherty in forum New To JavaReplies: 16Last Post: 04-24-2008, 05:39 PM


1Likes
LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks