Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: double to string causes divide by zero!



On Fri, 27 Feb 2004 10:01:37 -0500, "Philip Crotwell"
<email@hidden> said:
> Below is a test case that crashes with a divide by zero when appending
> a double to a string. The code basically looks like this, with 2
> threads doing it at the same time.
>
> double d = some special double String s = ""; s+=d;

Just out of curiosity, does it do this when you do:

s += Double.toString(d);

My personal preference would be to use this form anyways to avoid any
confusion. It probably produces the same byte code, but just as a check,
it might be worth a try.

Using a StringBuffer instead of a String might also be something to try.

That doesn't mean that there seems to be some sort of funky bug in the VM
or JIT that needs to be fixed, but in the mean time it is always nice to
be able to work around these things.

--
David G. Risner
Software Engineer
California State University, Los Angeles
http://www.risner.org/david/
_______________________________________________
java-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/java-dev
Do not post admin requests to the list. They will be ignored.


References: 
 >double to string causes divide by zero! (From: Philip Crotwell <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.