| Author |
Java fractions
|
Shirl Diva
Greenhorn
Joined: Sep 09, 2002
Posts: 21
|
|
Does anyone know how fractions are handled in java? How would you go about those kinds of computations?
|
 |
Marilyn de Queiroz
Sheriff
Joined: Jul 22, 2000
Posts: 9033
|
|
Fractions are handled with doubles by default. double quotient = 0; double dividend = 2 ; double divisor = 3 ; quotient = dividend / divisor ;
|
JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
|
 |
Shirl Diva
Greenhorn
Joined: Sep 09, 2002
Posts: 21
|
|
|
Thanx Marilyn. Is there a possiblity of a lose of precision - that occurs in division??
|
 |
Dirk Schreckmann
Sheriff
Joined: Dec 10, 2001
Posts: 7023
|
|
Yes. A few good links on this subject are mentioned in this past conversation in the Cattle Drive. Making any sense?
|
[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
|
 |
 |
|
|
subject: Java fractions
|
|
|