Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link

kenneth ga

+ Follow
since Aug 05, 2004
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by kenneth ga

Originally posted by Julian Kennedy:
Sorry Kenneth, I don't really see what you're getting at. If the value in a double named point_one is 0.1D then why would Double.toString(point_one) return 0.02 or 0.234?

hello jules, this is exactly my point that i want to be cleared out.
yes, indeed why should "0.1" be printed out as "0.02"?
but if it is printed as "0.10", is this a bug?

the specs of Double.toString(double), if i understood it correctly, does not specify on how many number of decimal places should be printed, so i can display "0.1000000000000000000000000000000" instead of just "0.1".

am i understanding it correctly?

thanks in advance.
17 years ago
thank you, thank you!

one last follow up..

does this mean that for example, in the java.lang, there is this Float class and has a method toString(float). And in the Java Specs, there are rules specified how to display a string representation of the float value.

What if I will modify the implementation and make the method display longer string for the float, say upto 20 digits.
Is this some kind of specs or rule violation?

also, does other company not permitted not to modify the core libraries?

thanks in advance.
17 years ago
oh, that's really interesting. that could give me enough answer.
do you still have that link or info? thanks..

one more thing, i believe that Sun's java comes with the core API and the platform. does this mean that the API specs used in this one are the ones documented in the site?

i really want to know what is the "standard" API specs and whether that specs are the ones located at Sun's. And that specs is not only "Suns Specs" and not really the original specs. Something like, they modified for them.

thanks again.
17 years ago
thanks for the reply.

does that mean that the specifications that I can find in Sun's website is the "standard" specification of java?

what happen if other company won't comply to the rules of that specs?

thanks in advance.
17 years ago
where can i find Java CORE API specs?

not SUN's API specs but the java itself.

17 years ago
i'm beginning to understand and the way seems clearer

however, i tried to look at the actual implementation of Double.toString(double) and in there, it manipulates the value of the "double" to be representable as "string". However, a double value of "0.1" which has no
actual decimal representation is being manipulated
to be representable in its closest value.
It just so happen that the implementation makes it
to "0.1" string. But the implementation can display
"0.02" or "0.234" as a representation of that double 0.1 value.

what i mean is, that it can represent any "string" value
since it is a string not an actual "double" value, the one
that is outputted by System.out.println().

I am understanding it right?

I hope you get my point.

17 years ago
thanks, you're probably right.

but, is there a rule in the toString(double) that says, the value will be rounded off when it's over the supported precision of "double"?

I can't find any or I could not understand what the Double.toString(double) really says about this one. Which I think is the one that is responsible in displaying the "double" string.

could anyone please spare some time for me on this one?

I really appreciate your help.

17 years ago
anybody could please explain why is it that System.out.println() when displaying a double rounds the value off or truncates the value?

say I have a code.

double d = 0.10000000000000000111512312578;

the output is "0.1" and not the exact value?

in the JLS, it provides some explanation, but if I understood it corretly, it seems that there is not definite format whether to display as "0.1" or the exact "0.10000000000000000111512312578" as long as it is the closest value to the double value..

17 years ago
I have installed RedHat 6.1 on a machine with mysql server running.
I am using mm jdbc driver for mysql and the files are uncompressed into the Linux box.
A sample program is created which issue jdbc call to the mysql database. The applet is compiled and run from the client PC with mm jdbc driver uncompressed to my PC. The mm jdbc driver path is added to the PC's class path.
That's all I have done so far. If I want to put the application on the Linux box and calls it via an html page without having the client PC to carry the mmJDBC driver, how can I do that? Has someone got experience in this kind of setup?
I really want to have everything runs on the Linux server (web server) and the client PC just simply use the browser to access.