Link to home
Start Free TrialLog in
Avatar of jl66
jl66Flag for United States of America

asked on

how print out all digits after decimal point for a variable (data type double) in java?

Would like to print out max digits for a variable (data type double). For example,
double d1 = 100.01234567890123456789012345678901234567890123456789
double d2 =  2.0
How to print out d1/d2, which still keeps exact answer?

Another one:
d1 = 1.0; d2 = 3.0
How to print out the digits of d1/d2 as many as possible for this data type?
Avatar of krakatoa
krakatoa
Flag of United Kingdom of Great Britain and Northern Ireland image

Not sure your question makes much sense - to me at any rate.
SOLUTION
Avatar of rrz
rrz
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jl66

ASKER

Thanks for the tip.
If BigDecimal is not used, there is anything we can do with "double" to test the digit limit for "double" after the decimal point? The reason is that many math functions only deal with "double", but not BigDecimal.  We want to keep the precision as high as possible.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jl66

ASKER

Thanks a lot.