Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / July 2005

Tip: Looking for answers? Try searching our database.

Parsing double with suffix

Thread view: 
Andrea Desole - 07 Jul 2005 10:20 GMT
I would generally expect the string "5" to be parses into the double
5.0, and the string "5f" not to be parsed. However I noticed, with big
surprise, that the string "5f" is also parsed into the double 5.0. So is
the string "5d".
I assume that the method parseDouble sees d and f as suffixes for the
type float and double. In fact, all the other letters after the number
5, including l, seem to fail.
This looks pretty strange to me, and I would like to find a way get an
error when parsing "5f" or "5d". Any help appreciated.
Thanks
Juergen Nickelsen - 07 Jul 2005 10:38 GMT
> I assume that the method parseDouble sees d and f as suffixes for
> the type float and double. In fact, all the other letters after the
> number 5, including l, seem to fail.

This is as documented in Double.parseDouble()/valueOf() and section
3.10.2 of the language specification.

Signature

For all resources, whatever it is, you need more.   -- RFC 1925

Andrea Desole - 07 Jul 2005 10:44 GMT
> This is as documented in Double.parseDouble()/valueOf() and section
> 3.10.2 of the language specification.

Damn, why don't I read the documentation of methods referred to by other
 methods' documentation.
Thanks


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.