NumberFormat parse() bug ? Please Help

It seems like parse() method of NumberFormat fails silently for string with a number in scientific notation such as "1.456000E+05" -- I had to use a doubleValue(0 from Double().
This very short piece illustrates it -- Can anyone please comment on any fallacies here ?
Thanks.
// Numberformat parse() fails when parsing
// string to get double value
// But Double.doubleValue() works
import java.io.*;
import java.text.*;
public class jf {
public static void main(String args[]) {
String str = "1.456000E+05";
System.out.println("Original string: str="+str);
NumberFormat nf = NumberFormat.getInstance();
try{
double val = nf.parse(str).doubleValue();
System.out.println("NumberFormat.parse() gives: val="+val);
} catch (Exception e) {;}
Double Val = new Double(str);
System.out.println("Double.doubleValue(): val="+Val.doubleValue());

Thanks, but changing to DecimalFormat ...
import java.io.*;
import java.text.*;
public class jf2 {
   public static void main(String args[]) {
      String str = "1.456000E+05"; // 145600.00 in E format
      System.out.println("Original string: str="+str);
      DecimalFormat df = new DecimalFormat();
      try{
         double val = df.parse(str,(new ParsePosition(0))).doubleValue();
         System.out.println("DecimalFormat.parse() gives: val="+val);
      } catch (Exception e) {;}
      Double Val = new Double(str);
      System.out.println("Double.doubleValue(): val="+Val.doubleValue());
}Still gave:
Original string: str=1.456000E+05
DecimalFormat.parse() gives: val=1.456
Double.doubleValue(): val=145600.0Does this indicate a bug ? jre is 1.3.1

Similar Messages

  • Baffled by a strange bug - please help!!!

    Hi all,
    I am baffled by a bug in a program I am working on that I just
    can't understand. Here is the code that causes a SIGSEGV crash:
    268      int k = wfall_pixbuf.rowstride;
    269      pix[0] = pix[ -k ];
    270      pix[0] = pix[ -wfall_pixbuf.rowstride ];
    Output of gdb:
    Program received signal SIGSEGV, Segmentation fault.
    0x00000000004152b2 in Display_Waterfall () at display.c:270
    270          pix[0] = pix[ -wfall_pixbuf.rowstride];
    wfall_pixbuf is a struct that encapsulates a GdkPixbuf together
    with some variables that hold the values of some properties like
    rowstride above.
    I added lines 268 and 269 in despair and the program
    works well if I comment out line 270, which does (I think)
    the same job as 269. I can't see how wfall_pixbuf.rowstride
    can change value from line 268 to 270???
    Please help!!!

    danielsoft wrote:
    hello,
    I think it's a type issue: what type is wfall_pixbuf.rowstride ?
    in the case
    int k = wfall_pixbuf.rowstride;
    pix[0] = pix[ -k ];
    you are making a negative value out of type "int" - precisely signed int
    when wfall_pixbuf.rowstride is unsigned, the result is undefined...
    what does
    pix[0] = pix[ -(int)wfall_pixbuf.rowstride ];
    do? should work the same as lines 268 and 269
    Ahh, thank you very much! rowstride is of type guint, which is
    a GTK2 type definition, essentially I think it boils down to
    unsigned int. So that was the issue :-)
    I am surprised that I didn't make a mistake of this sort till now
    but its never too late.... ;-)

  • Now Playing list. bugged please help me

    So i finally converted to the x-fi wave. Point is i was all happy until i encountered the sad and super annoying playlist of the new creative media player. before i had the audigy 2zc or w/e with the old media player. but it was a lot nicer, all the features were in it and u didn't have to open different panels to access a lot of the special settings.
    Point is, now i cant keep a clean record of the music i play. every time i open a new mp3. it deletes everything. only way to actually make a play list is to drag and drop a bunch ... thats way annoying. i think this is a bug. so please help me anybody Message Edited by archangel202 on 09-20-200708:27 PM

    thx so much
    xx *

  • Keyboard Bug - PLEASE HELP!

    I've purchased my Z10 less than 1 week ago and I've noticed this problem the very next day. At first I assumed it was a small problem and it wouldn't happen often but it's been occuring EVERY DAY at least once and it's gotten really irritating now. 
    The virtual keyboard on the Z10 works perfectly fine, the buttons dont stick, spell check is working properly and I'm able to type with this keyboard with no problems, HOWEVER for some odd reason the keyboard STOPS functioning sometimes while I'm sending an SMS. The keyboard is still visible, I'm still able to press the buttons on the keyboard as they become highlighted whenever I do. However, no actual letter/character appears in the message box no matter how many buttons I press. The only thing which seems to temporarily fix this problem is restarting my blackberry Z10 device which can be very annoying and time consuming.
    Please help me out with this problem as I have tried searching online for days and can't find a solution. Is this a problem with the Z10 software? will there be an update fixing this? am I the only one experiencing this problem?
    Please note that I have not once dropped my phone, it's been kept in MINT condition with a case on it. Everything else works perfectly fine with my Z10, this is the only MAJOR issue

    I just tried exactly what you said. Mis-spelled a word (easy for me) , hit the red underlined word, it popped up a window that said 'no suggestions', I tapped at the end of my sentence and carried on typing. No hang up at all.

  • SAX Parser Bug? Help!

    Javadoc for the SAX 1.0 API states its should be possible to reuse a parser object to parse one document after another. I have not been able to do this - I keep getting and error "EOF expected" even though endDocument() in HandlerBase has been called.
    Is this a bug?
    Thanks much...

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Joshua Introne ([email protected]):
    Javadoc for the SAX 1.0 API states its should be possible to reuse a parser object to parse one document after another. I have not been able to do this - I keep getting and error "EOF expected" even though endDocument() in HandlerBase has been called.
    Is this a bug?
    Thanks much...<HR></BLOCKQUOTE>
    Sorry - this isn't quite right. The final tag is parsed, but endDocument is never called. How can I get that event to be thrown without closing the stream feeding the inputSource?

  • Failed to parse eve:   please help

    failed to parse eve: /applications/adobe dreamweaver cc 2014.1/configuration/dialogs/eve/titanoptionaldialog.eve
    please help

    Hello,
    Please try the following:
    Force Quit Dreamweaver if its open.
    Please go to the location /applications/adobe dreamweaver cc 2014.1/configuration/dialogs/eve
    Take backup of file titanoptionaldialog.eve and move it to trash. Delete it from trash as well.
    Relaunch DW and check if it works.
    If that do not work then please uninstall and re-install Dreamweaver (also remove preferences) and then check.
    Regards
    Vivek

  • I have Mozilla Firefox an older 32 bit xp system with a flash player 10+ I am trying to up date to 17+ but am getting a parsing error please help

    I am quite frustrated it will not let me download the file so I cannot install I get the parsing error : unidentified element ... Can someone please answer or email me at [email protected]

    Hi,
    Can you please tell us how you are trying to install flash player and kindly post a screenshot of the error you are facing using How to post a screenshot in the forum
    Which service pack of Windows XP you are using ?
    -Varun

  • Problems building a spatial index - this must be a bug please help!

    Hi,
    We have a rather large spatial data warehouse. The schema is a star schema and is partitioned. During a load recently we had an error with one particular dataset, when building the index we got:
    ERROR at line 1:
    ORA-29855: error occured in the execution of ODCIINDEXCREATE routine
    ORA-06512: at "MDSYS.SDO_INDEX_METHOD_10I", line 10
    We have seen this kind of thing before, but usually dropping the data and reloading works fine (or rebuild the index). I should not that this obviously occurs before the partition is exchanged in. We are running 10.2.0.2 on red hat ES3.
    With this error we tried to reload the data, but get the same. We tried the data on another copy of the system, and the same. We have tried the data on a 10.2.0.3 and an 11.1.0.6 database and all fail at the same location. We have validated the geometries - all fine, I have tried changing the DIMINFO so that it spans the whole globe, it failes again (by the way we are on SRID 8307 and all data is point type). The data is approx 1.2M rows and I have tried subdividing it up into smaller tables and these all build fine. I have partitions with much higher row counts and these are fine. I have tried everything possible including changing index parameters e.g. parallel tablespace etc. I have tried it on a tablespace without ASSM and one with and both fail. I have an export of the data if anyone would be available to try it?
    I would really appreciate any help at all on this one.
    Thanks
    Jonathan

    There was a post a few months ago that addressed issues with 10.2.0.3 and Spatial index creation: Re: Fixed ...
    -Justin

  • My Iphone 6 Screen has been bugging Please Help

    My Iphone 6 Screen has been bugging out lately it bounces up and down and just gets really blurry. Does anyone know how to fix this?

    Hi,
    By "Bounces up and Down", do you mean this:
    The content of the screen drops down and about a third of the top of the screen is blank.
    When you press the home button or any icon, the content moves back to the top of the screen.
    If this is what you are seeing, it is intentional. It is meant as a way for you to be able to easily reach the icons at the top row of the screen.
    Double tap the home button. Do not press the button, just lightly tap it.
    All the content should drop down.
    Pressing the home button or any icon will shift the content back up again.
    This is a new feature designed for the larger screens in the 6 and 6+.

  • Major app store BUG, PLEASE HELP!!!

    This is the situation, I updated my iPhone to 3.1 then went to Settings - store and changed my iTunes details (Apple ID.) The new apple ID was a completely different E-mail address, then I went to the App Store, got a new app, this worked fine. Then I went to update my Apps, when I tapped FREE - install it displayed the wrong E-mail, no matter what I did. Please help

    same problem here-- any luck fixing it?

  • Touchpad bug please help?

    Okay so I'll be typing in an app.  Currently using Google voice, but also happens in notepad, safari.  Suddenly the app closes.  Or the paragraph I'm typing is deleted...or the app jumps to another app.
    What is the magic swipe/key I'm touching that causes this?  I'm typing on the bottom of the screen and the back button is up top so no idea here.
    Undo/Redo doesn't do anything.
    Shaking the ipad doesn't bring the text back either. 
    Any help appreciated.
    edit: I think I may have figured this out!

    First thing to try is to reset your device. Press and hold the Home and Sleep buttons simultaneously until the Apple logo appears. Let go of the buttons and let the device restart. See if that fixes your problem.

  • ResetPasswrd Bug - Please Help

    Hi,
    We are using the 11g ASP.Net membership provider, according to the Oracle documentation the ResetPassword method behaves as follows:
    "If an incorrect answer is supplied to the ResetPassword method, the internal counter that tracks invalid password-answer attempts is incremented by one."
    The counter does not appear to be incrementing. Is there some way of changing the stored procedure? Or a bug fix being released for this?
    Cheers.
    Ray

    First of all, RequiresQuestionAndAnswer must be set to true. Otherwise,
    invalid password-answer attempts are not tracked.
    Secondly, how long is the value (in minutes) you set for PasswordAttemptWindow
    property through passwordAttemptWindow attribute? The default value is 10 minutes.
    The doc about PasswordAttemptWindow property mentions,
    "The PasswordAttemptWindow property works in conjunction with the MaxInvalidPasswordAttempts
    property."
    But it does not mention that if the interval between the current failed attempt and the last failed
    attempt is greater than the PasswordAttemptWindow property setting, each failed attempt is
    treated as if it were the first failed attempt."
    In this case, the counter for password-answer attempts will remain 1 and does not increment.
    Microsoft doc about Membership.PasswordAttemptWindow Property says:
    "If the interval between the current failed attempt and the last failed attempt is greater than the
    PasswordAttemptWindow property setting, the current invalid attempt is counted as the first."

  • Solo bug - Please help!

    Hi!
    I've been woring in Logic for 9 years never experienced something like this.
    While im recording logic all of a sudden solos the audio track that im recoring in - without me doing ANYTHING.
    How do I get this to stop!? I can't work properly like this!
    Tried restarting, creating new project, nothing works.
    Thank you for your help.

    Hi
    Does the problem still show with the keyboard disconnected?
    Can you see MIDI CC3 activity in the MIDI display in the Transport (or in the default Monitor object in teh Clicks and Ports layer of teh Environment)?
    CCT

  • HT4528 My IPhone Bugged out/It is currently in the reset mode. I need to exchange all of my contacts from my Yahoo acct. to my new IPHONE. Can you please help me?

    Hello ,
    I purchased my IPHONE about 2 months ago. I am visiting family in DE & this tuesday it starting to go off & on by itself. Then the icons looked like they were floating . Then I could not call or text . The SIRI device would not work. Then it would shut down then the apple icon would reappear. I took it to a verizon dealer in Rehoboth DE & they said it BUGGED OUT/It is in a RESTORE MODE. It will not turn on. We could not transfer anny of my pics or contacts. I never even had a chance to back up the memory on ITUNES.
    The tech @ Verizon said to contact APPLE to trouble shoot and try and transfer the contacts from my yahoo acct.
    Can you please help?
    Gina

    set up your yahoo account in mail, contacts, calendars as an Exchange Account and you should be able to get your contacts from Yahoo from there.

  • All day calendar events not being displayed in the notification centre for iphone 5 post ios 7 upgrade. Please help. Is it a bug?

    All day calendar events not being displayed in the notification centre for iphone 5 post ios 7 upgrade. Please help. Is it a bug?
    With iOS 6, the all day events showed up in the notification centre but it lacks in the upgrade iOS 7.

    Same problem here. Some people pointed out that all-day events do show up in their notification center, but that seems only to be the case for birthdays (and only as text like the weather). I've tried it myself on my iPhone and iPad and it did work for birthdays but not for any other all-day events. I already sent this to Apple as a product feedback as well, as should everyone of you. The more people mention it, the faster Apple's going to fix this issue. In its current state, notification center is not a very helpful feature in my opinion. There's absolutely no point in not showing all-day events in the 'today' calendar overview.
    Here's a link to the product feedback page: http://www.apple.com/feedback/
    I posted my message in the iPhone section since I couldn't find a page specifically dedicated to iOS 7.
    I really love the look &amp; feel of iOS 7 but it's kinda sad to see notification center not tapping its full potential.
    Cheers!

Maybe you are looking for

  • How can I turn off email alerts in Lion server?

    I have a 2011 Mini Server.  I don't want to run any of the server software and followed the instructions in the Apple article "How to disable Lion Server".  The problem I'm having is that I keep getting email alerts, mostly the same one saying "The h

  • 6288 E65 Modem problems

    Hello I have managed to get both phones installed onto the PC. PC Suite recognises they are connected via data cable but will not recognise them as a modem. This used to work fine on an older version of PC suite so maybe a downgrade. Im at work at th

  • ME21 Purchase order number.

    hi friends,          i am in the process of writing a BDC program for transaction ME21 to create P.O, to run in Background via JOB through Batch input session method.          The purchase order number is generated internally, that means until P.O is

  • Create material with reference using BAPI

    Hi I need to create material using refrence to another material for all material Views. Can I use BAPI_MATERIAL_SAVEREPLICA. Which parameter I need to fill for reference materia Moderator message: please do your own research before asking. Edited by:

  • Zen V Plus Display Doesn't Update Total Number of Fi

    Hi everyone. I have the Zen V Plus 4 GB unit, and I'm using Vista Home Premium. I've encountered a problem I haven't been able to solve. I loaded ,036 audio files onto the unit, using the Media Explorer. That worked fine. I then disconnected the Zen