Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Parsing double with suffix

Reply
Thread Tools

Parsing double with suffix

 
 
Andrea Desole
Guest
Posts: n/a
 
      07-07-2005
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
 
Reply With Quote
 
 
 
 
Juergen Nickelsen
Guest
Posts: n/a
 
      07-07-2005
Andrea Desole <(E-Mail Removed)> writes:

> 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.

--
For all resources, whatever it is, you need more. -- RFC 1925
 
Reply With Quote
 
 
 
 
Andrea Desole
Guest
Posts: n/a
 
      07-07-2005


Juergen Nickelsen wrote:
>
> 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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ICS suffix MS Wireless Networking 0 08-11-2005 11:26 AM
cannot convert parameter from 'double (double)' to 'double (__cdecl *)(double)' error Sydex C++ 12 02-17-2005 06:30 PM
URL without suffix in .Net Victor Yuan ASP .Net 7 01-05-2005 03:17 AM
Firefox: Default suffix/regional Fr Jack Firefox 10 12-15-2004 08:10 PM
Perl expression for parsing CSV (ignoring parsing commas when in double quotes) GIMME Perl 2 02-11-2004 05:40 PM



Advertisments