Win a copy of High Performance Python for Data Analytics this week in the Python forum!

Greg Kelly

Greenhorn
+ Follow
since Jun 17, 2001
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
Received in last 30 days
1
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Greg Kelly

Thanks for your quick replies..
OK, so I tried out the BigDecimal thing, I created a double with a value of "0.00012345" and converted it to a BigDecimal and got 0.00012344999999999999203137424075293893110938370227813720703125
If it hadn't added those extra load of digits at the end it would have worked perfectly because converting that to a string yields the same result.
Does anybody know how to get it to maintain its actual value?
Thanks,
Greg
19 years ago
Hi,
I'm writing some code that involves converting a double to a string. The problem is that when I use the toString() function to convert it, it automatically changes it to scientific notation (ie. 0.001005 = 1.005E-3). The parser I have to deal with can't work with numbers in this format so I need to figure out how to prevent Java from converting my number to sci notation.
Any help would be greatly appreciated because I have to have this done for tomorrow!
Thanks,
Greg
19 years ago