Error adding double values

Processing in my application requires adding huge double values,
for instance i am adding 36561584400629760 and 1152062986011661
and instead of getting 37713647386641421 I get 37713647386641424.
Does somebody have a clue as to what the problem could be?
I tried using BigInteger and primitive double datatypes.
Thanks

doubles precision is about 16 digits. Try this     BigDecimal bd1 = new BigDecimal("36561584400629760"),
              bd2 = new BigDecimal("1152062986011661");
     System.out.println(bd1.add(bd2));
or
     BigInteger bi1 = new BigInteger("36561584400629760"),
              bi2 = new BigInteger("1152062986011661");
     System.out.println(bi1.add(bi2));

Similar Messages

  • Changing Time Zone (stsadm tzmove) = Error: Adding a value to a 'datetime' column caused an overflow

    After updating timezone.xml и RGNLSTNG.xml files for my SharePoint 2010 (SP2 - 14.0.7015.1000)
    I have to run this command to Update time zone on calendar events:
    stsadm -o tzmove -name "russ2014" -update all
    But this cause an error: Adding a value to a 'datetime' column caused an overflow
    ULS log event: System.Data.SqlClient.SqlException: Adding a value to a 'datetime' column caused an overflow.  The statement has been terminated.
    How to fix this?

    Hi,
    Whether you added new time zone definition to your timezone.xml 
    and  RGNLSTNG.xml files.  if not, please provide the details about what content you updated in timezone.xml and RGNLSTNG.xml files.
    The stsadm.exe –o tzmove command does not work for new time zone definition changes. 
    This command is designed for making changes in the existing time zone, 
    not for creating a new time zone definition.
    After you modify the Timezone.xml and Regnlstng.xml files to include the new time zone definition, you must restart Internet Information Services (IIS).
     To do this, click Start, click Run, type
    iisreset in the Open box, and then click
    OK.
    Try to do IIS restart, compare the results.
    Best Regards,
    Lisa Chen
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact 
    [email protected]

  • How to solve NaN error, while dealing with multiplication of double values

    i am getting NaN error in the program.
    consider this following code
    for (j=0;j<nh;j++)
    sum = 0.0;
    for (i=0;i<ni;i++){ sum = sum + (ai[i] * wi[i][j]) ;}
    //System.out.println(sum);
    ah[j] = sigmoid(sum);
    public static float sigmoid(float x)
    return ((Math.exp(x)- Math.exp(-x)) / (Math.exp(x)+Math.exp(-x)));
    ni = 2500-- no of input nodes;
    nh = 5000 -- no of hidden nodes;
    i am getting problem in calculating the "sum" value. its returning NaN for "sum".
    here a[i] values are around some +/- 0.XXXXXXXX upto 14 digits
    and wi[j][j] values are also +/- 0.XXXXXX upto 14 digits.
    all values are of datatype double.
    i was stucked up with this problem. what i am to do?
    give me suggestions..
    please reply me

    This can occur with double divisions. I wrote a small method that solves this:
         * Set double values that have a value of 'NaN' or 'Infinity' to 0.0. This can happen when dividing double values as they
         * don't cause a DivisionByZeroException.
         * @param value Double value to check.
         * @return Input value with 'NaN' and 'Infinity' set to 0.0.
        static public double resetNaN(final double value, final double resetValue) {
            return (Double.isNaN(value) || Double.isInfinite(value)) ? resetValue : value;
        }//resetNaN()

  • Data error - Double value of Sum row Aggregation

    Hello,
    I've recently created a new UNX universe based of SQL server query wich brings me determined values for payments and debts, when check the value on my XLS file wich is the main data source for the SQL DB, a single row is for 66,207.70 but on the universe when i check the values it doubles it.
    Here are four sets of pictures showing the value of a client PGE/ACRE when it's under AVG aggregation and when it's under SUM aggregation.
    Can someone help me identify the reason and how to fix it?

    Hi Marvin,
    In report level you getting double value so you can unchecked avoid duplicate row.
    Thank you
    Mustafa

  • Unable to display double values in Excel sheet using JExcel API

    Hi
    I am writing code to generate report in the form of Excel Sheet using JExcel API.
    Everything is going fine but whenever I want to put some double values in a cell it is only showing 2 decimal places. My problem is "I want to show upto five decimal places".
    Any kind of reply might help me lot.
    Thank U.

    If you enable the submit zero option, it still happens? This is a new feature on the display tabl
    #NumericZero Enhancements
    To display a numeric zero in place of an error message, you can enter #NumericZero in any of the three Replacement text fields. When you use the #NumericZero option:
    · Excel formatting for the cell is retained.
    · All calculations with dependency on the cell will compute correctly and will take the value of this cell as zero.
    · This numeric zero is for display only. When you submit, the zero value is NOT submitted back to the data source.
    You cannot set display strings for cells that contain an invalid member or dimension name (metadata error). Metadata errors produce standard descriptive error messages.
    Errors are prioritized in the following order from highest to lowest. The error message for a higher-priority error takes precedence over that for a lower-priority error.
    1. (Highest) Metadata errors
    2. #No access
    3. #Invalid/Meaningless
    4. #No data\Missing

  • Custom Error Message in Value Help

    Hi,
    In my application i have a Inputfield called "CLASS", for which i have added a value help..it has these values
    B    Business
    E    Economy
    F    First Class
    When the user enters a value(say "X") other than B, E, and F, it displays a message
    <b>String "X" does not match the enumeration</b>
    I want to put my own message like " Please enter a valid value" instead of the above message.
    Please let me know how to do this ?
    Thanks
    Senthil

    Senthil,
    First, "looping through the list and checking the user entered value with values in the list" is possible only with non-validating actions. Using non-validating actions is a tricky task in real life.
    Second, workarounds are possible, but they involves calculated attributes (like here: /people/valery.silaev/blog/2005/11/29/800format-your-way). Solving this problem generically (45 attributes is a good number to start with a generic solution) will result in solution with complexity comparable to this: https://weblogs.sdn.sap.com/pub/wlg/3309. [original link is broken] [original link is broken] [original link is broken] [original link is broken] [original link is broken] Do you need such thing just to alter error message?
    Valery Silaev
    EPAM Systems
    http://www.NetWeaverTeam.com

  • Error in Moving values to field symbols. - CX_SY_CONVERSION_NO_NUMBER

    Hi Friends,
    I have asigned the component 'ICON' to the field symbol . While i am adding the value to the field symbol it is going for Dump.
    Erro Message :
    Unable to interpret "@08\QGreen Light; Go; Okay@ " as a number.
    Error analysis
        An exception occurred that is explained in detail below.
        The exception, which is assigned to class 'CX_SY_CONVERSION_NO_NUMBER', was not
         caught and
        therefore caused a runtime error.
        The reason for the exception is:
        The program attempted to interpret the value "@08\QGreen Light; Go; Okay@ " as
         a number, but
        since the value contravenes the rules for correct number formats,
        this was not possible.
    Code :
      ASSIGN COMPONENT 'ICON' OF STRUCTURE <line> TO <fs_icon>.
      add wa_result-icon to <fs_icon>.
    Please find the information and i waiting for your valuable anwers.
    Thanks,
    Shankara Narayan

    HI,
    What do you mean by adding the value?
    Do you want to move the value of wa_result-icon to the field-symbols <fs_icon>.
    use move statement or use '=' operator.
    ADD will try to do an addition.
    You cannot add character fields. It will surely give a dump.
    Do as follows:-
    Move wa_result-icon to <fs_icon>.
    Regards,
    Ankur Parab

  • Precission error with double 32668.6536

    I have found something really odd adding two double values that add up to 32668.6536.
    Instead of getting this double Im getting 32669.653599999998.
    I cant think of a good reaso why the Java is doing this wild conversion. Any tips would be appreciated.
    This is some sample code to replicate the problem. Ive tested it with JRE 1.4 and 1.6. I've also tested it with different double values that add up to 32668.6536 and it always fails.
    public class DoubleAdd {
         public static void main(String[] args) {
              double a, b,c;
              a = 32668.5536;
              b = 1.1;
              c = a + b;
              //32668.5536 + 1.1 = 32668.6536
              System.out.println("A + B = "+c );
    }Any idea of what is going on?
    Gonso

    PhHein wrote:
    [SOME THINGS YOU SHOULD KNOW ABOUT FLOATING-POINT ARITHMETIC|http://java.sun.com/developer/JDCTechTips/2003/tt0204.html#2]
    [What Every Computer Scientist Should Know About Floating-Point Arithmetic|http://docs.sun.com/source/806-3568/ncg_goldberg.html]
    [Another good (slightly simpler) FP explanation|http://mindprod.com/jgloss/floatingpoint.html]
    None of those explain why 32668.6536 + 1.1 is not even close to 32668.6536. But reply number 1 explains it perfectly!

  • Replicat error: ORA-12899: value too large for column ...

    Hi,
    In our system Source and Target are on the same physical server and in the same Oracle instance. Just different schemes.
    Tables on the target were created as 'create table ... as select * from ... source_table', so they have a similar structure. Table names are also similar.
    I started replicat, it worked fine for several hours, but when I inserted Chinese symbols into the source table I got an error:
    WARNING OGG-00869 Oracle GoldenGate Delivery for Oracle, OGGEX1.prm: OCI Error ORA-12899: value too large for column "MY_TARGET_SCHEMA"."TABLE1"."*FIRSTNAME*" (actual: 93, maximum: 40) (status = 12899), SQL <INSERT INTO "MY_TARGET_SCHEMA"."TABLE1" ("USERID","USERNAME","FIRSTNAME","LASTNAME",....>.
    FIRSTNAME is Varchar2(40 char) field.
    I suppose the problem probably is our database is running with NLS_LENGTH_SEMANTICS='CHAR'
    I've double checked tables structure on the target - it's identical with the source.
    I also tried to manually insert this record into the target table using 'insert into ... select * from ... ' statement - it works. The problem seems to be in the replicat.
    How to fix this error?
    Thanks in advance!
    Oracle GoldenGate version: 11.1.1.1
    Oracle Database version: 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
    NLS_LANG: AMERICAN_AMERICA.AL32UTF8
    NLS_LENGTH_SEMANTICS='CHAR'
    Edited by: DeniK on Jun 20, 2012 11:49 PM
    Edited by: DeniK on Jun 23, 2012 12:05 PM
    Edited by: DeniK on Jun 25, 2012 1:55 PM

    I've created the definition files and compared them. They are absolutely identical, apart from source and target schema names:
    Source definition file:
    Definition for table MY_SOURCE_SCHEMA.TABLE1
    Record length: 1632
    Syskey: 0
    Columns: 30
    USERID 134 11 0 0 0 1 0 8 8 8 0 0 0 0 1 0 1 3
    USERNAME 64 80 12 0 0 1 0 80 80 0 0 0 0 0 1 0 0 0
    FIRSTNAME 64 160 98 0 0 1 0 160 160 0 0 0 0 0 1 0 0 0
    LASTNAME 64 160 264 0 0 1 0 160 160 0 0 0 0 0 1 0 0 0
    PASSWORD 64 160 430 0 0 1 0 160 160 0 0 0 0 0 1 0 0 0
    TITLE 64 160 596 0 0 1 0 160 160 0 0 0 0 0 1 0 0 0
    Target definition file:
    Definition for table MY_TAEGET_SCHEMA.TABLE1
    Record length: 1632
    Syskey: 0
    Columns: 30
    USERID 134 11 0 0 0 1 0 8 8 8 0 0 0 0 1 0 1 3
    USERNAME 64 80 12 0 0 1 0 80 80 0 0 0 0 0 1 0 0 0
    FIRSTNAME 64 160 98 0 0 1 0 160 160 0 0 0 0 0 1 0 0 0
    LASTNAME 64 160 264 0 0 1 0 160 160 0 0 0 0 0 1 0 0 0
    PASSWORD 64 160 430 0 0 1 0 160 160 0 0 0 0 0 1 0 0 0
    TITLE 64 160 596 0 0 1 0 160 160 0 0 0 0 0 1 0 0 0
    Edited by: DeniK on Jun 25, 2012 1:56 PM
    Edited by: DeniK on Jun 25, 2012 1:57 PM

  • JSlider using double values instead of INT

    I need to create a slider that uses double values instead of ints...
    the default constructor is JSlider temp = new JSlider(JSlider.HORIZONTAL, int, int, int)....but i need to use
    JSlider temp = new JSlider(JSlider.HORIZONTAL, double,double,double)
    I want my slider to go from like 1.0 to 10.0 ....any ideas?
    thanks

    me has ritten a sample code fur ya... mite help...
    sorrie... not commented properly...
    import java.awt.event.*;
    import java.util.Vector;
    import javax.swing.event.*;
    import java.awt.*;
    import javax.swing.*;
    public class Test extends JPanel {
         //Variable Declarations...
         JPanel valuesPanel;
         public JSlider slider;
         public JTextField midText;
         public JTextField lowText;
         public JTextField highText;
         int precision=1000;//to convert to double...(100-> 2decimal places, 1000->3decimal places.......)
         double lowLimit = 0;
         double midLimit = 5;
         double highLimit = 10;
         public Test() {
              initialize();
              addListeners();
              initComponents();
              addComponents();
         public void initialize() {
              valuesPanel = new JPanel();
              highText = new JTextField();
              midText = new JTextField();
              lowText = new JTextField();
              slider = new JSlider();
         public void addListeners() {
              addTextListenerTo( highText );
              addTextListenerTo( midText );
              addTextListenerTo( lowText );
              // if the slider is moved, the value of the mid will be updated in the testbox.
              // Sliders work on integers and not on double. so the limits are divided by precision to get a double number.
              slider.addChangeListener(
                   new ChangeListener() {
                        public void stateChanged( ChangeEvent e ) {
                             double n = ( double ) ( ( JSlider ) e.getSource() ).getValue();
                             midLimit = n / precision;
                             midText.setText( Double.toString( midLimit ) );
         * Sets different attributes and properties of the components
         public void initComponents() {
              highText.setText( Double.toString( highLimit ) );
              midText.setText( Double.toString( midLimit ) );
              lowText.setText( Double.toString( lowLimit ) );
              slider.setPaintTrack( true );
              slider.setPaintTicks( true );
              slider.setMinimum( ( int ) ( lowLimit * precision ) );
              slider.setValue( ( int ) ( lowLimit * precision ) );
              slider.setMaximum( ( int ) ( highLimit * precision ) );
         * Add all the components to the container (Panel).
         public void addComponents() {
              setLayout( new BorderLayout() );
              valuesPanel.setLayout( new GridLayout( 3, 3, 5, 5 ) );
              valuesPanel.add( new JLabel("Low") );          
              valuesPanel.add( highText );
              valuesPanel.add( new JLabel("Mid") );
              valuesPanel.add( midText );
              valuesPanel.add( new JLabel("High") );
              valuesPanel.add( lowText );
              add( valuesPanel, BorderLayout.CENTER);
              add( slider, BorderLayout.SOUTH);
         * Adds Focus and Action Listeners to the TextFields
         public void addTextListenerTo( JTextField textField ) {
              textField.addFocusListener(
                   new FocusAdapter() {
                        public void focusLost( FocusEvent evt ) {
                             updateLimits( ( JTextField ) evt.getSource() );
                        public void focusGained( FocusEvent evt ) {
                             String tempOldString = ( ( JTextField ) evt.getSource() ).getText();
              textField.addActionListener(
                   new ActionListener() {
                        public void actionPerformed( ActionEvent evt ) {
                             updateLimits( ( JTextField ) evt.getSource() );
         * This function is called when any action is performed on the text. It checks
         * if the value is valid and if not it displays a message. Also it updates the
         * slider value.
         *@param textField
         public void updateLimits( JTextField textField ) {
              double tempN = 0;
              try {
                   tempN = Double.parseDouble( textField.getText() );
                   if ( textField.equals( lowText ) ) {
                        lowLimit = tempN;
                        slider.setMinimum( ( int ) ( lowLimit * precision ) );
                   else if ( textField.equals( highText ) ) {
                        highLimit = tempN;
                        slider.setMaximum( ( int ) ( highLimit * precision ) );
                   else if ( textField.equals( midText ) ) {
                        midLimit = tempN;
                        slider.setValue( ( int ) ( midLimit * precision ) );
              } catch ( Exception ex ) {
                   JOptionPane.showMessageDialog( this, "Not a Number", "Error !!!", JOptionPane.WARNING_MESSAGE );
                   textField.setText( "0" );
         public static void main(String args[]) {
         JFrame f=new JFrame("test Frame");
         f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         f.getContentPane().add(new Test());
         f.pack();
         f.setVisible(true);

  • Adding parametric value to role programmatically

    I would like to add a large number of parametric values to a parametric role and I have tried the following code to do so:
    String sql = "Select distinct majorcode from GS_Contacts";
    Fuego.Lib.Role rl = Role.find(name:"GS_Department");
    if(rl != null){
              foreach(row in DynamicSQL.executeQuery(sql, externalResource))
                   String param = row[1]+"";
                   logMessage(param);
                   rl.addParameter(param);
    }In studio I get an error: Role 'GS_Department' could not be updated to this server. Reason: 'Invalid process definition. Trying to add a role (organization:GSE, commonName:GS_Department:180001GC) and the field Identification Number cannot be null.
    And in Weblogic, I get no error, but the values are not added.
    I need to do a one-time load of 260 values, and then make the editable later (adding and deleting from this initial list).
    Thanks in advance.

    Hi Shannon,
    The Fuego.Fdi.DirOrganizationalRole has an array parametricValues that you have to manipulate in order to add or remove parameters to that role, after manipulating it call the methos update().
    The Fuego.Fdi.DirHumanParticipant has an array rolesAssignment of type Fuego.Fdi.RoleAssignment that you have to manipulate to add or remove role assignments to a participant, the after call update() for the DirHumanParticipant.
    HTH

  • Cash Flow Report (FSI3/FSI5) pulling double value

    Dear SAP Experts
    I am creating a Cash Flow Statement via FSI3 /FSI5. While selecting key figure "Total Credit Postings" system is pulling the double values for the assigned GL. Please see below;
    Please see the output.
    GL total credit value is 269610.68 where as report is showing value 539221, which is double the value.
    Any suggestions to correct the error??
    Regards
    Syed Zia Abbas

    Hi Melia
    For your calculation, you can cross check your logic with actual values form table and  see why it is not matching in case of INCORRECT amount.
    Cash Flow is genuinely generated per Fiscal year and that will show the comparison of Reporting year (For Ex Current Year) with comparison year (For Ex Last Year).
    As a correct solution, you can give selection parameter as below;
    Reporting Year
    Reporting Pd From
    Reporting Pd To
    Comparison Year
    Comparison Pd From
    Comparison Pd To.
    That is the way I have created CFS. Let me know if you need more info.
    Regards
    Syed Zia Abbas

  • INI: XOQ-01600: OLAP DML Error "ORA-01438: value larger than specified prec

    I have created a Time dimension in AWM 11.1.0.7.0B.
    I have added two Hierarchies to it. One Hierarchy has All Years, Year, Week, day. The second hierarchy has All Years, Year, Quarter.
    When I maintain the dimension, the following error occurs:
    An error has occurred on the server
    Error class: Express Failure
    Server error descriptions:
    INI: Error creating a definition manager, Generic at TxsOqConnection::generic<BuildProcess>
    INI: XOQ-01600: OLAP DML Error "ORA-01438: value larger than specified precision allowed for this column
    " while executing DML "SYS.AWXML!R11_LOAD_DIM('TIME.ALL_GREGORIAN_YEARS.LEVEL' SYS.AWXML!___R11_LONG_ARG_VALUE(SYS.AWXML!___R11_LONG_ARG_DIM 1) 'TIME.END_DATE.ATTRIBUTE' 'TIME.TIME_SPAN.ATTRIBUTE' 'TIME.LONG_DESCRIPTION.ATTRIBUTE' 'TIME.SHORT_DESCRIPTION.ATTRIBUTE' 'TIME.ALL_GREGORIAN_YEARS_END_DATE.ATTRIBUTE' 'TIME.ALL_GREGORIAN_YEARS_TIME_SPA.ATTRIBUTE' 'TIME.ALL_GREGORIAN_YEARS_LONG_DES.ATTRIBUTE' 'TIME.ALL_GREGORIAN_YEARS_SHORT_DE.ATTRIBUTE' 'TIME.ALL_GREGORIAN_YEARS_TIME_SPA1.ATTRIBUTE' 'TIME.ALL_GREGORIAN_YEARS_TIME_SPA2.ATTRIBUTE' 'TIME.ALL_GREGORIAN_YEARS_TIME_SPA3.ATTRIBUTE' 'TIME.ALL_GREGORIAN_YEARS_LONG_DES1.ATTRIBUTE' 'TIME.ALL_GREGORIAN_YEARS_SHORT_DE1.ATTRIBUTE' 'TIME.ALL_GREGORIAN_YEARS_TIME_SPA4.ATTRIBUTE' 'TIME.ALL_GREGORIAN_YEARS_LONG_DES2.ATTRIBUTE' 'TIME.ALL_GREGORIAN_YEARS_SHORT_DE2.ATTRIBUTE' 'TIME.GREGORIAN_QUARTER_END_DATE.ATTRIBUTE' 'TIME.GREGORIAN_QUARTER_TIME_SPAN.ATTRIBUTE' 'TIME.GREGORIAN_QUAOLAP DML Error "%(1)s" while executing DML "%(2)s", Generic at TxsOqStdFormCommand::execute
    at oracle.olapi.data.source.DataProvider.callGeneric(Unknown Source)
    at oracle.olapi.data.source.DataProvider.callGeneric(Unknown Source)
    at oracle.olapi.data.source.DataProvider.executeBuild(Unknown Source)
    at oracle.olap.awm.wizard.awbuild.UBuildWizardHelper$1.construct(Unknown Source)
    at oracle.olap.awm.ui.SwingWorker$2.run(Unknown Source)
    at java.lang.Thread.run(Thread.java:595)

    The most likely explanation is that you have a numeric attribute whose data type precision is less than that of the column it is mapped to. For example if you had an attribute with data type NUMBER(2) and you mapped it to a column with data type NUMBER(5), then you could get this error on load. Note that some of the attributes may not be visible in AWM. The offending SQL statement should be in the OUTPUT column of the CUBE_BUILD_LOG, but you may be able to fix this by just describing the view associated with the dimension. For example, here is the description of a TIME view created in 11.2..
      Name                            Null?    Type
    DIM_KEY                             VARCHAR2(60)
    LEVEL_NAME                             VARCHAR2(30)
    MEMBER_TYPE                             VARCHAR2(1)
    DIM_ORDER                             NUMBER
    END_DATE                             DATE
    TIME_SPAN                             NUMBER
    LONG_DESCRIPTION                        VARCHAR2(60 CHAR)
    SHORT_DESCRIPTION                        VARCHAR2(60 CHAR)
    MONTH_END_DATE                         DATE
    MONTH_TIME_SPAN                        NUMBER(5)
    MONTH_LONG_DESCRIPTION                    VARCHAR2(60 CHAR)
    MONTH_SHORT_DESCRIPTION                   VARCHAR2(60 CHAR)
    FISCAL_QUARTER_END_DATE                   DATE
    FISCAL_QUARTER_TIME_SPAN                   NUMBER(5)
    FISCAL_QUARTER_LONG_DESC                   VARCHAR2(60 CHAR)
    FISCAL_QUARTER_SHORT_DES                   VARCHAR2(60 CHAR)
    FISCAL_YEAR_END_DATE                        DATE
    FISCAL_YEAR_TIME_SPAN                        NUMBER(5)
    FISCAL_YEAR_LONG_DESCRIP                   VARCHAR2(60 CHAR)
    FISCAL_YEAR_SHORT_DESCRI                   VARCHAR2(60 CHAR)
    CALENDAR_QUARTER_END_DAT                   DATE
    CALENDAR_QUARTER_TIME_SP                   NUMBER(5)
    CALENDAR_QUARTER_LONG_DE                   VARCHAR2(60 CHAR)
    CALENDAR_QUARTER_SHORT_D                   VARCHAR2(60 CHAR)
    CALENDAR_YEAR_END_DATE                    DATE
    CALENDAR_YEAR_TIME_SPAN                   NUMBER(5)
    CALENDAR_YEAR_LONG_DESCR                   VARCHAR2(60 CHAR)
    CALENDAR_YEAR_SHORT_DESC                   VARCHAR2(60 CHAR)You can get the same information from user_cube_attributes
    SQL> select attribute_name, data_precision from user_cube_attributes where dimension_name = 'TIME' and data_type = 'NUMBER';
    ATTRIBUTE_NAME                 DATA_PRECISION
    TIME_SPAN
    MONTH_TIME_SPAN                    5
    FISCAL_QUARTER_TIME_SPAN              5
    FISCAL_YEAR_TIME_SPAN                   5
    CALENDAR_QUARTER_TIME_SPAN              5
    CALENDAR_YEAR_TIME_SPAN               5

  • How can I limit a double value to two decimal place?

    How can I limit a double value to two decimal place?
    Java keeps on adding zero's to a simple double subtraction:
    1497 - 179.64 = 1317.3600000000001The answer must have been simply: 1317.36

    If the trouble is with output ...
    If the trouble is with value accuracy ...The trouble is with OPs understanding of and/or expectations of IEEE 754 floating point numbers. o_O
    [And it's probably a view (output) issue.]
    how can i actually use numberformat to cut those
    unwanted decimal places?Read the API - Puce already provided the link.

  • WPF Data gird double value in cell round up automatically

    Hi All,
      I have one datagrid where one of the columns contains double values. I placed limitations on length and decimal part. Decimal part is always comes with 2 digits. Now during editing the cell that holds double value in DataGrid , if I enter value of
    99.99 then it is becoming 100. At this moment the cell is still under edit mode.
     If the columns hold decimal type values then this automatic round up is not happening. But due to some constraints , at this moment we can't change the columns type from  double to decimal. So I just want to disable the auto round up with double
    values in DataGrid. I searched in MSDN forums but did not find any , tried adding StringFormat for columns. But it did not help.
    I tested by keeping the double value outside of the DataGrid ( in editbox ) , I don't see any automatic round up. So I suspect there could be something with DataGrid that is resulting automatic round up.
    Is there any way to disable this automatic round op on double values in DataGrid? I welcome your comment.
    Thanks,
    Brahmaji.

    Well, 99.99 as you mentioned in your original post is not the same value as 9999999999999999. You cannot store the value 9999999999999999 in a double field.
    You could change the type to decimal to be able to store values with a higher precision:
    public class Movie
    public string Title { get; set; }
    public int Year { get; set; }
    public string Director { get; set; }
    public bool Hit { get; set; }
    public decimal Price { get; set; }
    new Movie()
    Title = "The Lawnmower Man",
    Year = 1992,
    Director = "Brett Leonard",
    Hit = true,
    Price = 22.23M
    If you want to prevent the value of the source property from getting set when an invalid double value is entered you could implement your own ValidationRule:
    namespace SampleGrid
    class MyValidationRule : System.Windows.Controls.ValidationRule
    public override System.Windows.Controls.ValidationResult Validate(object value, System.Globalization.CultureInfo cultureInfo)
    string s = value.ToString();
    double d;
    if(double.TryParse(s, out d))
    return new System.Windows.Controls.ValidationResult(false, "invalid value");
    return System.Windows.Controls.ValidationResult.ValidResult;
    <DataGridTemplateColumn Header="Price">
    <DataGridTemplateColumn.CellTemplate>
    <DataTemplate>
    <TextBlock Text="{Binding Price, StringFormat=##.00}"/>
    </DataTemplate>
    </DataGridTemplateColumn.CellTemplate>
    <DataGridTemplateColumn.CellEditingTemplate>
    <DataTemplate xmlns:local="clr-namespace:SampleGrid">
    <TextBox>
    <TextBox.Text>
    <Binding Path="Price" StringFormat="##.00">
    <Binding.ValidationRules>
    <local:MyValidationRule ValidationStep="RawProposedValue"/>
    </Binding.ValidationRules>
    </Binding>
    </TextBox.Text>
    </TextBox>
    </DataTemplate>
    </DataGridTemplateColumn.CellEditingTemplate>
    </DataGridTemplateColumn>
    <!--<DataGridTextColumn Header="Price"
    Binding="{Binding Price, StringFormat=##.00}" />-->
    Then the value won't get rounded. Of course you can still not set the double source property to 9999999999999999 though.
    There is no property that you can set on the DataGrid to prevent the value from getting rounded.
    Hope that helps. 
    Please remember to helpful posts as answer to close the thread and then start a new thread if you have a new question.

Maybe you are looking for

  • How can I edit budgeted cost/unit in excel and then import into P6?

    I would like to edit resource assignements (budgeted cost/unit) month by month in an excel file, and then import it into P6. Is this possible? It seems that the resource assignments month by month cannot be exported to an excel file. Is there anyone

  • My Master server is stopping automatically unable to find out the issue

    Dear Experts, My Master server in CMC is stopping automatically and is going to infinite stop state.when i again restart manually its connecting but again it is stopping.what may be the cause unable to find the solution Thanks in Advance, Regards, Vi

  • Message determination in purchase order

    Hi , We have maintained the Condition record for NEU by Tcode MN04 based on Document type and medium as default Fax and it is working fine however when we are trying to maintain the condition record for a particular vendor by Doc type/Purch.Org/Vendo

  • Trouble printing markups

    I need to be able to draw trim lines around art in PDFs.I discovered that I could easily draw a box around them in Acrobat with the Markup tool, but then, the box won't print. How do I get it to print? I'm using Acrobat 9 Pro, on Windows 7 Thanks in

  • How to add scroll bar to JDesktopPane?

    Hi All,      After download the "InternalFrameDemo.java" from the swing tutorial, I want to add scrollbars to JDesktopPane so that whenever a internal frame moves off the desktop view port, a scrollbar will display. I have tried many ways to implemen