Exception with floating point number

I get the following message if i try to import a floatingpoint number (12.12 is the number).
oracle.xml.sql.OracleXMLSQLException: 'java.lang.NumberFormatException: 12.12' encountered during processing ROW element 0. All prior XML row changes were rolled back. in the XML document.
I4ve tested anything with '.', ',' NLS-Parameters and so on.
The Bugfix is now to multiply the number with 100. It4s not fine, but it works.
Thanks in advance,
Oliver Friedrich
null

Hello,
this is a short piece of my code. I think there is all information you need.
Greetings
Oliver Friedrich
String xmlControl = "CONTROL"; // XML tag
String dbControl = "XML_CONTROL"; // Database table
OracleXMLSave saveObject = new OracleXMLSave(conn, dbControl);
saveObject.setRowTag(xmlControl);
saveObject.setIgnoreCase(true);
saveObject.setDateFormat("yyyyMMdd");
int count = saveObject.insertXML((Document)docImport);
XML-File:
<?xml version="1.0" encoding="UTF-8"?>
<ROOT>
<CONTROL>
<NUMBER>12</NUMBER>
<COST>123.45</COST>
</CONTROL>
</ROOT>
Database-Table
desc XML_CONTROL
Column Name Null? Type
NUMBER NUMBER(12)
COST NOT NULL FLOAT(32)
null

Similar Messages

  • Determining whether an integer is a floating-point number

    I want to create a program that when an integer is input into the numeric constant, a floating-point number with all zeros to the right of its decimal point will light the LED on the front panel. The LED will remain unlit for any other floating-point number. I know I want to use a Round to Nearest function, but not sure where to go from there. 

    rtufaro wrote:
    I want to create a program that when an integer is input into the numeric constant,
    You mean CONTROL, right?
    You just need a type of rounding.  Doesn't matter if you round up or down.  So you just round and then compare the input to the rounded value.  If they are equal, you light up your LED.  So all you need is a numeric control, 2 functions, and a boolean indicator.

  • How to restrict the decimal place of a floating point number?

    Hi,
    Here is my code:
    public void TwoDecimal(double u){
         String w = Double.toString(u);
         int c = w.length();
         System.out.println(c);
         if (c <= 5)
            double a = Double.parseDouble(w);
            System.out.println(a);
         else
            System.out.println("Invalid input!");
      }I want to show a floating point number which has 2 digits and 2 decimal places, e.g. 45.82, 29.67. This number is input by user and passed as a parameter.
    For those case like the above sample floating point numbers, it can display the proper value of 'c'. e.g. 45.67 will display 5.
    However, when I passed 99999, it will show 7; 9999 will return 6, not 5.
    So, if the user does not input the '.', does it append 2 implicit chars to it? i.e. 99999.0 and 9999.0. So, that's why it returned 7 and 6 for the length of the string respectively.
    How can I fix it?
    and
    Does it has better algorithm?
    Pls advise.
    gogo

    When dealing with a known precision, in your case hundredths, it is often a good idea to use an integer type and add in the decimals on printing only. This is often the case in banking systems. Almost all of them use integer types, (read long) in pennies to store monitary values. Ever seen someone type in a value for a credit card machine? For something like $20 they press.. "2" "0" "0" "0" The machine knows the lowest denomonation in a cent, so it knows where to put the decimal place. I suggest you do something like this. It also helps to avoid base 2 round off errors.
    -Spinoza

  • Maximum size of a floating-point number

    Morning all,
    Does anyone know what the maximum size of a floating point number can be under Solaris 8 running on
    a V880?
    Regards,
    Richard Breckon

    I'm not sure what you're asking.
    The maximum size is 128 bits.
    The maximum value is as given in /usr/include/float.h: 1.189731495357231765085759326628007016E+4932L

  • X64 Asm floating point number adressing .

    Dear Community
    Please kindly inform us about the number offloating-point
    addressing mode x64 Asm
    Best Regards
    Rafał Bator

    Hi RB_1,
    Your issue is out of support range of VS General Question forum which mainly discusses
    WPF & SL designer, Visual Studio Guidance Automation Toolkit, Developer Documentation and Help System
    and Visual Studio Editor.
    You post the issue in this thread:
    https://social.msdn.microsoft.com/Forums/en-US/78825b09-d948-4676-a343-1791bad36603/asm-codnig-floating-point-number?forum=vcgeneral
    so I will remove this thread. Please discuss your issue on that thread or opening new thread on Visual C++ forum.
    Thanks,
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Check Floating Point Number

    Hello All,
    I am having some trouble checking the value of a field with Key Figure type Number with 8 byte floating point. I want to read that field and populate another field with an X if true. For example if that field is equal to 5,0000000000000000E+07 then i want to mark the other field with an 'X'.
    The problem is in my code, how do i read that number in the fltp field, such as the number above. my code reads as follows for the 'X' field.
        if SOURCE_FIELDS-abc123 eq 5000000.
          RESULT = 'X'.
        endif.
    Thanks everyone in advance

    You don't need to worry about converting the code into standard format or floating, just implement your code as you want and it will automatically take care of the conversion. Basically 5,0000000000000000E+07 = 50,000,000.
    thanks.
    Wond

  • Floating point Number & Packed Number

    Hai can anyone tell me what is the difference in using floating point & packed Number .
    when it will b used ?

    <b>Packed numbers</b> - type P
    Type P data allows digits after the decimal point. The number of decimal places is generic, and is determined in the program. The value range of type P data depends on its size and the number of digits after the decimal point. The valid size can be any value from 1 to 16 bytes. Two decimal digits are packed into one byte, while the last byte contains one digit and the sign. Up to 14 digits are allowed after the decimal point. The initial value is zero. When working with type P data, it is a good idea to set the program attribute Fixed point arithmetic.Otherwise, type P numbers are treated as integers.
    You can use type P data for such values as distances, weights, amounts of money, and so on.
    <b>Floating point numbers</b> - type F
    The value range of type F numbers is 1x10*-307 to 1x10*308 for positive and negative numbers, including 0 (zero). The accuracy range is approximately 15 decimals, depending on the floating point arithmetic of the hardware platform. Since type F data is internally converted to a binary system, rounding errors can occur. Although the ABAP processor tries to minimize these effects, you should not use type F data if high accuracy is required. Instead, use type P data.
    You use type F fields when you need to cope with very large value ranges and rounding errors are not critical.
    Using I and F fields for calculations is quicker than using P fields. Arithmetic operations using I and F fields are very similar to the actual machine code operations, while P fields require more support from the software. Nevertheless, you have to use type P data to meet accuracy or value range requirements.
    reward if useful

  • Can I implement advanced control algorithm with floating-point computations in Ni 7831R ?

    Hi,
    I plan to use a Ni 7831R to control a MIMO nano-positioning stage with servo rate above 20kHz. The control algorithm is based on robust control design and it is much more complex than PID. it also includes floating-point caculations. Can I implement such algorithm with Ni 7831R?
    By the way, is there any way to expand the FPGA gates number for Ni 7831R? Suppose I run out of the FPGA gates (1M), can I add more FPGA gates by buying some different hardware?
    Thanks
    Jingyan
    Message Edited by Jingyan on 08-22-2006 01:45 PM

    Jingyan,
    as long as there is no GPU core implemented on the FPGA these devices only support integer arithmetic. NI's FPGA targets currently don't contain a GPU core so there is no native floating point arithmetic available.
    Still there are several options to implement floating point arithmetic on your own or to work around this target specific limitation. Here are some links that might help:
    Floating-Point Addition in LabVIEW FPGA
    Multiplying, Dividing and Scaling in LabVIEW FPGA
    The NI 7831R uses an 1M FPGA. If your application requires more gates the NI 7833R (3M) is a good solution.
    I hope that helps,
    Jochen Klier
    National Instruments Germany

  • Issue with fixed point number output from 9219 module for full bridge measurement (cRIO/FPGA)

    Hi,
    I have a question regarding the fixed point output acquired from a 9219 module (in FPGA on a cRIO) when setup to acquire a strain measurement (full bridge).
    Software: Labview 2009
    Hardware: cRIO-9012 (NI-RIO 3.2.1), NI-9219 module
    The 9219 module is configured in the project as follow:
    Ch0: Full-Bridge +/- 7.8mV/V
    Ch1: Voltage +/- 4V
    Ch2: Voltage +/- 15V
    Ch3: Voltage +/- 60V
    The calibration mode is 'Calibrated' so the FPGA outputs fixed point numbers. 
    My issue is that the precision of the fixed point number for Ch0 (strain) is "(fixed point <+/-32,-1>[-2.5e1,2.5e1]:1.16e-10)", which indicates that the fixed point number is a value between +/- 0.25 and not the +7.8mV/V as I expected?
    The fixed point number does not change in precision whether the range for the strain measurement is set at +/- 7.8mV/V or +/-64mV/V (the two available options).
    As the fixed point number doesn't change precision I'm assuming that changing the range of the strain measurement changes the resolution of the acquired number? And as such I will need to perform additional scaling on the fixed point number to convert it to the expected range?
    There is no mention of scaling of the voltage or strain measurements mentioned in any documentation or examples, with the only scaling example provided for the thermocouple measurements.
    Any help/clarification is much appreciated.
    Regards,
    Mike

    Hello Mike,
    Hopefully I can help clarify some of the behavior you are seeing.
    My issue is that the precision of the fixed point number for Ch0 (strain) is "(fixed point <+/-32,-1>[-2.5e1,2.5e1]:1.16e-10)", which indicates that the fixed point number is a value between +/- 0.25 and not the +7.8mV/V as I expected?
    For calibrated values on the FPGA VI, the returned data is a Voltage measurement, not a directly calculated strain value. Based on the specified ranges for the 9219 in a Full bridge configuration, 250 mV will encompass all possible input values, at the module provided excitation (2-2.7V dependent on the sensor gage resistance).
    The fixed point number does not change in precision whether the range for the strain measurement is set at +/- 7.8mV/V or +/-64mV/V (the two available options).
    As you may notice from the fix-point definition, the fixed point data contains 32-bit precision which is larger than the acquired precision of 24-bits provided by the 9219. The fixed point data-type is coded to accept input encompassing both the range and precision of the instrument; such that, no additional coercion of the input data values is required based on user-defined software settings, i.e. the bridge sensitivities +/- 7.8mV/V or +/-64mV/V. 
    As the fixed point number doesn't change precision I'm assuming that changing the range of the strain measurement changes the resolution of the acquired number? And as such I will need to perform additional scaling on the fixed point number to convert it to the expected range?
    The documentation does not clearly define that by varying the discrete levels of strain input (+/- 7.8mV/V or +/-64mV/V) the range of the ADC on the module is also adjusted. I am working to follow up further on this topic, to provide a clarification on the module documentation. As for scaling, the voltage values acquired regardless of the ADC resolution will still be related strain via the bridge sensitivity. The resolution of the ADC will simply define the smallest measurable change in the strain value. 
    There is no mention of scaling of the voltage or strain measurements mentioned in any documentation or examples, with the only scaling example provided for the thermocouple measurements.
    For converting the acquired voltage values to a strain measurement, I would recommend the documentation linked here for a detailed explanation on strain calculation. Often, users will forward the acquired voltage data as fixed point values through a DMA FIFO to the RT controller on the Compact RIO; such that, they may handle conversion from voltage to strain using floating point math in real-time. 
    I hopes these responses provided a bit of clarity. I will continue to work to provide additional information on the 9219 specification information. Please post back any further questions.
    Cheers!
     Edit: Forgot to add the link.
    Message Edited by Pcorcs on 04-14-2010 04:55 PM
    Patrick Corcoran
    Application Engineering Specialist | Control
    National Instruments

  • What's the best way to deal with floating point errors?

    What's the best way to deal with the decimal number errors in Flex?
    Lets say I have:
    var number1:Number = 1.1;
    var number2:Number = 1;
    var result:Number = number1 - number2;
    trace(result);
    I get "0.10000000000000009".
    What's the best way to deal with this so that i get the right result?
    Using the trick: result = Math.round( result * Math.pow(10,13) ) / Math.pow(10,13); is not useful as such when using big numbers.
    For example, If number1 = 100000000001.1, and number2 = 0.2, I get "100000000000.90001" as result. The previous rounding fixes rounding errors after 13th decimal, but here the first rounding errors come after 4 digits.
    The toPrecision method in Number and NumberFormatter dont seem be of use by themselves because of the same reason.
    So I'd have to check how big the number is, and then round the number based on that.
    So far I've constructed a method that does that with logarithms like this:
    public function floatFix(number:Number):Number{
          var precision:int = 14-Math.floor(Math.log(Math.abs(number))*Math.LOG10E);
          var precisionFactor:Number = Math.pow(10, precision);
          return Math.round(Number(number*precisionFactor))/precisionFactor;
    It just seems rather odd that one would have to create and use something like that to just count 1.1-1; There's a lot of calculating in that method, and i'm guessing that having to use that in a loop could slow down a program quite a bit.
    I think there really should be a pre-built method in flex for something like this, but I can't find any.
    Anyone know any better/faster ways?

    Use the application server database pooling services to create a datasource that can be access using JNDI.
    Move the database access code to a Servlet so that a JSP submits a form to the Servlet that does the database access and packages the data into a bean which is passed to another JSP to be displayed.

  • JSlider with Floating point values

    I desperatly need to create a JSlider with floating/decimal values. For example between 0 and 1 and ticks within an interval of 0.1.
    The default behaviour of JSlider doesn't allow me to do so, hence is there any other way around ? I know it's possible to programmatically handle the required calculation by divding the values by 10, 100 or anything, but i want to display the actual values (floating/decimal) on the JSlider bar.
    Thanks in advance

    this might do you for the display
    import javax.swing.*;
    import java.awt.*;
    class JSliderLabels extends JFrame
      public JSliderLabels()
        setLocation(400,200);
        setDefaultCloseOperation(EXIT_ON_CLOSE);
        JSlider slider = new JSlider(0, 100, 1);
        slider.setMajorTickSpacing(25);
        slider.setPaintTicks(true);
        java.util.Hashtable labelTable = new java.util.Hashtable();
        labelTable.put(new Integer(100), new JLabel("1.0"));
        labelTable.put(new Integer(75), new JLabel("0.75"));
        labelTable.put(new Integer(50), new JLabel("0.50"));
        labelTable.put(new Integer(25), new JLabel("0.25"));
        labelTable.put(new Integer(0), new JLabel("0.0"));
        slider.setLabelTable( labelTable );
        slider.setPaintLabels(true);
        JPanel jp = new JPanel();
        jp.add(slider);
        getContentPane().add(jp);
        pack();
      public static void main(String[] args){new JSliderLabels().setVisible(true);}
    }

  • Null pointer Exception with Float.parseFloat

    I need to assign a float value from a database to a variable recurrently throughout a while loop. but i am getting a null pointer exception error:
    while ( rs.next() )
         out.println("<TR>");
              float corr = Float.parseFloat((String) request.getParameter("echo"));
              out.println("<center><TD><b><font color = #990000>" + rs.getString("race_number") + "</b></TD>");
              out.println("<center><TD><b><font color = #990000>" + rs.getString("sail_number") + "</b></TD>");
              out.println("<center><TD><b><font color = #990000>" + rs.getString("finish_time_elapsed") + "</b></TD>");
              out.println("<center><TD><b><font color = #990000>" + rs.getString("echo") + "</b></TD>");
              out.println("</TR>");
    I've also tried:
    float corr = Float.parseFloat( String request.getParameter("echo"));
    float corr = 0;
    corr Float.parseFloat((String) request.getParameter("echo"));
    corr = echo;
    corr = request.getParameter("echo");
    corr = rs.getString("echo");
    corr = Float.parseFloat(request.getParameter("echo"));
    temp = rs.getFloat("Problem_Description");
    Any ideas Please!!!

    Null pointer exception means that the value you are trying to turn into a Float is null. Probably request.getParameter("echo") returns null.
    Is "echo" a request parameter, or a field you want to get from the database?
    request.getParameter() has nothing to do with a database query.
    That is your http request coming from the form submission. It won't change.
    If "echo" is meant to be a request parameter, then make sure the parameter is actually present.
    If its a database field (stored as a number) then
    float corr = rs.getFloat("echo");
    should do the trick.
    Can the value be null in the database?
    Cheers,
    evnafets

  • Floating point number to IBM bytes

    Hello,
    I'm trying to convert a float value to a byte array (but in IBM standard).
    I understand that the general idea will be the following algorithm:
    1. process the sign, exponent and fraction from the float value (using IBM standard)
    2. build the bytes from the S, E, F from step 1.
    So far, I only have the step 2 like this:
    public static byte[] toBytesIbm( int signBit, int exponent, long fraction ) {
    byte[] bytes = new byte[4];
    bytes[0] = (byte)(signBit + exponent);
    bytes[1] = (byte)((fraction & 0x00FF0000) >> 16);
    bytes[2] = (byte)((fraction & 0x0000FF00) >> 8);
    bytes[3] = (byte)(fraction & 0x000000FF);
    return bytes;
    Getting the sing bit is also not a problem, so the real work is in getting the exponent and fraction from the number. I don't know how to do this. I have code from a trusted source to convert from IBM bytes to IEEE float numbers, so I can check if the bytes are correct.
    Can anyone help me with this?
    Thanks in advance

    Brushfire wrote:
    Thanks for the correct. I'm never quite sure about the masks, but I've had issues with extra data being introduced before, so I like it better safe than sorry. The mask is needed when a narrower primitive has been sign-extended to a wider primitive, and you want to keep the result unsigned.
    But in this case, the result is then cast to byte, which removes all the upper bits that the mask was trying to set to zero in the first place.
    If you need to store a byte in an int without sign-extension, you need a mask:
    int n = someByte & 0xFF;If you want to store the lower 8 bits of an int in another int, you need a mask:
    int lowerEight = someInt & 0xFF;But if you want to store the lower 8 bits in a byte, just cast:
    byte lowerEight = (byte)someInt;

  • Dealing with floating point numbers...

    Please I would be very happy if someone could help me on getting something right.
    When ever I divide 2 numbers and the denominator is greater than the numerator, it results in the number zero(0);
    I want to be able to plot a financial histogram on a canvas.
    I do is get the highest amount from an array of monthly financial amounts and compare it to the maximum plottable bar.
    What I realize is that the amount is always far greater than the highest number of pixel plottable.
    So in order to get a scale of pixel to amount, I divide the highest amount by the highest plottable pixel.
    This always results in the number 0, hence, I find it dificult to plot any amount at all.
    How can i overcome this problem. Please I need your urgent help...

    hi friend
    iam not able to record voice in j2me toolkit it showing error this is my midlet to create a voice recorder
    import javax.microedition.midlet.*;
    import javax.microedition.lcdui.*;
    import javax.microedition.media.control.RecordControl;
    import javax.microedition.media.Manager;
    import javax.microedition.media.MediaException;
    import javax.microedition.media.Player;
    import java.io.ByteArrayInputStream;
    import java.io.ByteArrayOutputStream;
    import java.io.IOException;
    public class recordMidlet extends MIDlet implements CommandListener {
    private Form init = new Form("info");
    private Command rec = new Command("rec",Command.OK, 1),
    stop = new Command("stop",Command.STOP, 1),
    exit = new Command("exit",Command.EXIT, 1);
    private byte[] recordedSoundArray;
    private Player p;
    private RecordControl rc;
    private ByteArrayOutputStream output;
    public void startApp() {
    init.addCommand(rec);
    init.addCommand(stop);
    //init.addCommand(exit);
    init.setCommandListener(this);
    Display.getDisplay(this).setCurrent(init);
    public void pauseApp() {
    public void destroyApp(boolean unconditional) {
    public void commandAction(Command com, Displayable dis) {
    if(com == exit) notifyDestroyed();
    else if(com == stop) {
    init.removeCommand(stop);
    init.addCommand(exit);
    try {
    init.append("finish record... starting playback\n\n");
    rc.stopRecord();
    rc.commit();
    p.stop();
    p.close();
    init.append("playing...\n");
    recordedSoundArray = output.toByteArray();
    init.append("recorded sound = " String.valueOf(recordedSoundArray.length)"\n\n");
    ByteArrayInputStream recordedInputStream = new ByteArrayInputStream(recordedSoundArray);
    Player p2 = Manager.createPlayer(recordedInputStream,"audio/x-wav");
    p2.prefetch();
    p2.start();
    //init.append("finish playing...");
    catch (Exception e) {
    init.append("stop command: "+e.toString());
    else if(com == rec) {
    try {
    init.append("record voice ...\n\n");
    // Create a Player that captures live audio.
    p = Manager.createPlayer("capture://audio");
    p.realize();
    // Get the RecordControl, set the record stream,
    rc = (RecordControl)p.getControl("RecordControl");
    output = new ByteArrayOutputStream();
    rc.setRecordStream(output);
    rc.startRecord();
    p.start();
    //Thread.currentThread().sleep(3000);
    } catch (IOException ioe) {
    init.append(ioe.toString());
    } catch (MediaException me) {
    init.append(me.toString());
    when i start recording the toolkit is hanging so plz help me

  • Problem with floating point precision

    Hello!
    I need to store in a variable a number like this 1234512345.123412345.
    But when I store it on a double or long double... it gets truncated to 1234512345.123412... only six decimals?
    What can I do??
    Thanks!

    If you are going to use the BigDecimal class, it is worth bearing in mind a tip that was passed on to me from georgemc. If you create the BigDecimal class instances using the constructor that accepts a String as input, then you can easily specify how many digits should follow the decimal point.

Maybe you are looking for

  • Is it necessary to have pages on mac to have it on iPad?

    Hello people! I am thinking of getting pages for iPad and I was wondering if it is necessary to have pages on mac to have it on iPad, because I don't own a mac or a computer with pages on it... Any help.

  • LMS 3.2 and ACS 5.1 authentication issues

    Hi all, Installed LMS 3.2 (running Common Services 3.3.0) and i'm having problems authenticating. I get the error :- -Tacacs+ Connectivity - Reachable -HTTP/HTTPS Connectivity - Not Reachable...Protocol mismatch detected. AAA client - Not Applicable

  • Flex 4 localization question

    Hello, I have an application MyAdd compiled with only one locale, the en_US one. I have another project for locales where I compile them and move them to main project bin-debug/lang folder. When loading another locale at runtime, let say fr_FR, i get

  • Transfert des contact iphone sur ipad

    Bonjour; Mon calendrier se transfert tout seul sur mon ipad il est bien synchroniser par contre les contacts que j ai sur mon iphone n'apparaissent pas sur mon ipad ... Comment faire ?

  • Replaced my IPOD and registering with ITUNES

    I had to replace my IPOD when the old one broke. When I go to ITUNES it won't let me register the new IPOD because I arleady have an account. How do I eliminate the old IPOD and register the new one?