Subtracting two numbers in double format gives incorrect result

Hello,
I have a table with two fields in Number (Field Size: Double; Decimal Places: Auto).  When using a query i try to subtract one field from the other I get incorrect results:
Field1
Field2
Result
2.60299223923846
2.60259423701324
3.98002225218796E-04
0.644498511499839
0.645908903902985
-1.41039240314556E-03
1.51021791504783
1.51372591514976
-3.50800010193808E-03
<tfoot></tfoot>
When I paste the above into Excel, I get the correct results:
Field1
Field2
Result
2.60299223923846
2.60259423701324
                     0.00039800222521880
0.64449851149984
0.64590890390299
                   (0.00141039240314556)
1.51021791504783
1.51372591514976
                   (0.00350800010193808)
Would much appriciate any help in how to get the correct values in Access Query.
Thank you

Field1
Field2
Result
2.60299223923846
2.60259423701324
3.98002225218796E-04
0.644498511499839
0.645908903902985
-1.41039240314556E-03
1.51021791504783
1.51372591514976
-3.50800010193808E-03
Hi Vasilii,
In my opinion the results are correct, only they are presented in scientific notation. You can do some formatting, to display the results the way you want.
See the Help on the use of Format.
Imb.

Similar Messages

  • Maps can not find my location, or gives incorrect results

    when I tap the "locator" icon at the bottom right of Maps, it can't find my location, or gives incorrect results such as San Francisco, or somewhere south of Detroit, MI

    This is what I did, and it worked for me. My location was coming up in the correct city, Philadelphia, but at the wrong neighborhood, a couple of miles away. I turned off the wifi, and made the locator find me by Edge only. Then I turned the Wifi back on and had the locator find me again, and it went back to the wrong location, but 2 seconds later found the correct address within a few blocks. I have the Original iPhone BTW.

  • Comparing two numbers with different formats

    Dear Java developers
    I am trying to compare two numbers but they have different formats. long x = 8981261369, Object obj = "8,981,261,369".
    I am trying to see if this two values are equal which is the case in the example above except one has a thousand separator but not sure how to do that.
    How can I lose the thousand separator and just compare them as two long values.
    Your input will be much appreciated
    Thanks

    iu433 wrote:
    I need a generic way of doing this. Because sometimes the Object does not have a thousand separator. Can i use some kind of NumberFormat to do this.You'll need to know what formats the string (not the number--as already mentioned, numbers don't have formats) can have, and then try them one by one.
    Of course, there can be some ambiguity. Does "123,456" represent one hundred twenty three thousand four hundred fifty six, or is that comma a decimal separator, and it represents one hundred twenty three and four hundred fifty six thousandths?
    The point is, you have to have a clear definition of what formats are allowed and how to determine which one it is. There's no magic way for Java to do that for you.

  • ITSM Search on status with "is not" gives incorrect results due to SLA statuses

    Hi,
    When executing a search on Solution Manager ITSM tickets, on the search criterion Status and with operator "is not", the result list does not give correct results.
    For example, an incident with status "Confirmed IRT Exceeded" does show up when searching with criterion "Status is not Confirmed".
    Is there any solution for this behaviour?
    Kind Regards,
    Joyca

    Hi Vivek,
    Thanks for the Knowledge Article.
    The content of the document would indeed help if we only wanted to find "not confirmed" tickets.
    However, the same thing is happening on other statuses. For example searching for "status is not proposed solution" is still not possible with the descriptions in the knowledge document, since the user status "proposed solution" is linked to system status "in process" (I1003), like all the other in-between user statuses such as "customer action" and "in process" etc.
    The only workaround that I see is to use only "is" as operator and never "is not". However, the underlying problem remains. I think it should be possible to use also "is not" without having issues due to those SLA statuses...
    Kr,
    Joyca

  • NumberFormat Parse gives incorrect result for comma separator

    I have a string 1,5 and i am creating NumberFormat with US locale. I expect NumberFormat.parse method to give me exception for string 1,5 string. But it doesn't. The result is 15 for 1,5 string. Please help.
    I have a class where i did test. I have tried 3 cases. All 3 cases didn't work. Any idea how to solve it?
    import java.util.*;
    import java.text.*;
    public class testv
         public static void main(String[] args)
              DecimalFormatSymbols symbols = new DecimalFormatSymbols(Locale.US);
              System.out.println("Decimal separator: "+symbols.getDecimalSeparator());
              System.out.println("Group separator: "+symbols.getGroupingSeparator());
              String s = "1,5";
              NumberFormat fmt = NumberFormat.getInstance(Locale.getDefault());
              Number num = null;
              try
                   //start of case 1*********
                   num = fmt.parse(s);
                   //end of case 1************ desn't work
                   //start of case 2*********
                   /*ParsePosition parsePosition = new ParsePosition(0);
                   num = fmt.parse( s, parsePosition);
                   if (! ((parsePosition.getIndex()) == ( s.length() )) )
                        throw new ParseException("parseerror",0);
                   //end of case 2*********          desn't work     
                   //start of case 3*********
                   /*if (fmt instanceof DecimalFormat)
                        ParsePosition parsePosition = new ParsePosition(0);
                        num = fmt.parse( s, parsePosition);
                        if (! ((parsePosition.getIndex()) == ( s.length() )) )
                             throw new ParseException("parseerror",0);
                   //end of case 3************ desn't work
              catch (Exception e)
                   e.printStackTrace();
              System.out.println("Parse string: "+s+" result: " + num.toString()+" result in double: "+num.doubleValue()+" locale: "+Locale.getDefault());
         }

    Hi,
    According to your description, I am afraid your problem is out of support in C# forum. For ASP.NET question, please go to
    ASP.NET Forum to post your thread.
    Best Wishes!
    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. Thanks<br/> MSDN Community Support<br/> <br/> Please remember to &quot;Mark as Answer&quot; the responses that resolved your issue. It is a common way to recognize those who have helped you, and
    makes it easier for other visitors to find the resolution later.

  • Adding 2 doubles together yields incorrect results

    I have a problem with adding 2 doubles to produce a running total where it appears to also add 0.0000000000000(1 to 9).
    The code illustrates my problem and is causing a big issue, I have found references to fix this which use BigDecimal but I want to now what is going wrong.
    public class Test1
    public static void main(String args[])
    String strValue = "";
    double dTotal = 0;
    double dTotalOLD = 0;
    dTotalOLD = dTotal;
    strValue = "0.0252154";
    dTotal = dTotal + (Double.parseDouble((String)strValue));
    System.out.println(dTotalOLD + " + " + strValue + " = " + dTotal);
    dTotalOLD = dTotal;
    strValue = "0.0250356";
    dTotal = dTotal + (Double.parseDouble((String)strValue));
    System.out.println(dTotalOLD + " + " + strValue + " = " + dTotal);
    System.out.println("dTotal = " + dTotal);
    Actual Results =
    0.0 + 0.0252154 = 0.0252154
    0.0252154 + 0.0250356 = 0.050251000000000004
    dTotal = 0.050251000000000004
    Expected Results =
    0.0 + 0.0252154 = 0.0252154
    0.0252154 + 0.0250356 = 0.050251
    dTotal = 0.050251
    In the main application I upload a file and sum the items for validation but most of the time the total is not what I expect.
    What am I doing wrong?
    Mark

    If you really absolutely need exact results, use BigDecimals.
    With doubles, not even 0.1 is exactly 1/10. The IEEE double value closest to 0.1 is approximately 0.1+5.5511*10^-18 -- there is a slight, but significant difference. In calculations these "representation errors" along with others accumulate and eventually can give you relative errors of significant magnitude, although most of the time they stay under 10^-14, 10^-15

  • Why does viewing the same file in two diff. versions of Photoshop give diff. results?

    Hey,
    Our designers use CS2 for their work. All of the designs that they work on are in black and white. When the same file is opened at a given zoom %, the files seem to have a different view for CS2 and CC. The print size ofcourse is the same, but our work involves viewing designs of 700 dpi at 3-5% and the difference in viewing the same files matters.
    We want to upgrade our software, because CC is way better in so many other functions but this is the only thing that is stopping us from doing so. Please let me know if there's a way to fix this or is it just something we have to accept with the upgrade.
    I will share screenshots of both the version with the same file soon.
    Thanks.

    Thanks for the suggestion, Chris.
    Same issue, new question - don't ask me why I did this, but while both Photoshop and the now corrupted file were open, I changed the name of the folder containing the file, then continued to save the open version of the file without first closing it and reopening it from the newly renamed folder. Could this have caused both files in that folder to become corrupted in different ways? The other file that gives me the "file is empty" error was not open at the time, but it was in that folder. I'm thinking maybe by changing the path to the files while Photoshop was running, that could have triggered this. ?? I have 3 1TB internal drives raided to read as 1 drive, so I'm really hoping that one of these disks is not dying on me as you suggested. I was also backing up an external drive using BackBlaze when this all occurred - any possible connection? How can I find out if one of my three raided drives (and which one) might be going bad?
    Thanks!!

  • Incorrect results for calculation based on diff dimensions - 11.1.1.5

    Hello All,
    OBIEE gives incorrect results when i try to perform a calculation (for eg: addition) based on 2 measures. For eg:
    (Note: "->" signifies 1:M)
    Rpd (Physical model & BMM): dim_fe -> dim_gl-> Fact_Legder <- Dim_param
    Fact_Ledger (agg measures) -> YTD_01, YTD_02...... YTD_12 ( here 01,02...12 represent month i.e. if "Feb" selected in prompt then we need to use YTD_02 and so on for other months)
    Answers: Created a report with following columns
    Column Name : Formula
    =================
    Line Item : 'Net Profit'
    Prev Yr Act: (filter("Fact Ledger"."YTD_12" using "Fact_Ledger"."YEAR"=@{pYear}{2013}-1 and "Dim_Param"."PL_Line" in ( 'Item 1','Item 2','Item 3') and "Fact_Ledger"."Code"=100)/1000) /
    (filter("Fact Ledger"."YTD_12" using "Fact_Ledger"."YEAR"=@{pYear}{2013}-1 and "Dim_FE"."Item" in ( 'L1','L2','L3') and "Fact_Ledger"."Code"=100)/1000)
    Curr Yr Act: (filter("Fact Ledger"."YTD_12" using "Fact_Ledger"."YEAR"=@{pYear}{2013} and "Dim_Param"."PL_Line" in ( 'Item 1','Item 2','Item 3') and "Fact_Ledger"."Code"=100)/1000) /
    (filter("Fact Ledger"."YTD_12" using "Fact_Ledger"."YEAR"=@{pYear}{2013} and "Dim_FE"."Item" in ( 'L1','L2','L3') and "Fact_Ledger"."Code"=100)/1000)
    Curr Yr Plan: case when '@{pmonth}{Jan}='Jan' then
    (filter("Fact Ledger"."YTD_01" using "Fact_Ledger"."YEAR"=@{pYear}{2013} and "Dim_Param"."PL_Line" in ( 'Item 1','Item 2','Item 3') and "Fact_Ledger"."Code"=200)/1000)/
    (filter("Fact Ledger"."YTD_01" using "Fact_Ledger"."YEAR"=@{pYear}{2013} and "Dim_FE"."Item" in ( 'L1','L2','L3') and "Fact_Ledger"."Code"=200)/1000)
    when '@{pmonth}{Jan}='Feb' then
    (filter("Fact Ledger"."YTD_02" using "Fact_Ledger"."YEAR"=@{pYear}{2013} and "Dim_Param"."PL_Line" in ( 'Item 1','Item 2','Item 3') and "Fact_Ledger"."Code"=200)/1000)/
    (filter("Fact Ledger"."YTD_02" using "Fact_Ledger"."YEAR"=@{pYear}{2013} and "Dim_FE"."Item" in ( 'L1','L2','L3') and "Fact_Ledger"."Code"=200)/1000)
    when '@{pmonth}{Jan}='Dec' then
    (filter("Fact Ledger"."YTD_12" using "Fact_Ledger"."YEAR"=@{pYear}{2013} and "Dim_Param"."PL_Line" in ( 'Item 1','Item 2','Item 3') and "Fact_Ledger"."Code"=200)/1000)/
    (filter("Fact Ledger"."YTD_12" using "Fact_Ledger"."YEAR"=@{pYear}{2013} and "Dim_FE"."Item" in ( 'L1','L2','L3') and "Fact_Ledger"."Code"=200)/1000)
    endthe results are incorrect. Any help appreciated.
    Qry generated is like
    (select...
    case when year=.. and pl_lin=... and code=100 then ytd_01,
    case when year=.. and pl_lin=... and code=100 then ytd_03,
    case when year=.. and pl_lin=... and code=100 then ytd_04,....,
    case when year=.. and pl_lin=... and code=200 then ytd_01,
    case when year=.. and pl_lin=... and code=200 then ytd_03,
    case when year=.. and pl_lin=... and code=200 then ytd_04,....,
    from...
    where ... year in (2013-1,2013) and pl_line('Item1,'Item2','Item3') or fe.item('l1','l2','l3') and code in (100,200)... ) D1
    (select
    case when 'Apr'='Jan' thne d1.c1 when 'Apr'='Feb' then d1.c2......
    from D1
    Regards..
    Shruti

    See if this explains it better for my crosstab with page items of Vendor Number 1234.
    Vendor 1234
    Dc Nbr 1 2 4 AAAA
    Sum Invoice Amt 1387.04 300.82 327.29 2015.15
    Sum Cost 44.86 57.43 25.54 127.83
    Sum Advanced Cost 102.44 0 0 102.44
    Sum Consolidation Cost 30.37 0 0 30.37
    Sum Allowance Amt 27.74 6.02 6.54 40.30
    Net Freight Cost 149.93 51.41 19 220.34
    Freight Percent 10.81 17.09 5.81 ****
    As stated before, Frieght Percent is a calculation I created in Discoverer that looks like this :
    ( NVL(Sum Cost,0)+NVL(Sum Advanced Cost,0)+NVL(Sum Consolidation Cost,0)-NVL(Sum Allowance Amt,0) )/NVL(Sum Invoice Amt,0)*100
    Column AAAA was created in Discoverer using Sum of field and show to the right.
    What I need is for the **** to be the correct calculation for the totals in column AAAA. If I use do a total for Freight Percent using the Cell Sum I get 33.70., what I want is it to be 10.93, which is (127.83 + 102.44 + 30.37 - 40.30)/2015.15*100.
    If I use an Average Total row for Freight Percent, I get 11.24 which is 33.70 / 3 (the 3 would be the # of dc nbr's)
    I did start with using the detail level data to create this crosstab. Then I made a new version and used the SUM data. I seem to get the same results but am still having issues with the one **** value.
    Hopefully this explains it better.
    Thanks for the ideas so far.

  • Subtracting two parameters using overloaded methods.

    Could someone please tell me where I am making my mistakes.
    The idea is to pass the variables to two parameters that then subtracts them regardless of order (larger parameter - smaller parameter) and gives a result.
    Any help is greatly appreciated.
    public class OverLoad{
      public static void main(String[] args){
        int n1 = 25;
        int n2 = 10;
        double d1 = 15.0;
        double d2 = 30.0;
    // This is what the output should look like minus the negative numbers.
    /*System.out.println("Parm1 Type \tParm2 Type 2 \tResult Type");
        System.out.println(n1 + "\t\t" + n2 + "\t\t" +(n1 - n2));
        System.out.println(d1 + "\t\t" + d2 + "\t\t" +(d1 - d2));
        System.out.println(n1 + "\t\t" + d2 + "\t\t" +(n1 - d2));
        System.out.println(d1 + "\t\t" + n2 + "\t\t" +(d1 - n2));
    public static int max(int parm1, int parm2){
        if (parm1 < parm2) {
                 int temp = parm1;
                 parm1 = parm2;
                 parm2 = temp;
    System.out.println(+ parm1, + parm2 = "");
      public static double max(double parm1, double parm2){
        if(parm1 > parm2){
          return parm1;
        return parm2;
      public static double max(int parm1, double parm2){
        if(parm1 > parm2){
          return parm1;
        return parm2;
      public static double max(double parm1, int parm2){
        if(parm1 > parm2){
          return parm1;
        return parm2;
    }

    That's what I have been trying but with no success.
    I have two pieces of code.
    This is what I am looking for except two of the numbers need to be double and it doesn't use enough methods. When I try to do that I get compiling errors.
    public class Overload{
      public static int max(int parm1, int parm2){
        int diff = 0;
        if(parm1 > parm2){
          diff = parm1 - parm2;
        else{
          diff = parm2 - parm1;
        return diff;
      public static void main(String args[]){
        int maxValue = 0;
         int n1 = 5;
         int n2 = 10;
         int d1 = 12; // this should be a double
         int d2 = 20; // this should be a double
         System.out.println("Parm1 Type\tParm2 Type\tResult");
        maxValue = max(n1, n2);
        System.out.println(n1 +"\t\t" + n2 +"\t\t" + maxValue);
        maxValue = max(d1, d2);
        System.out.println(d1 +"\t\t" + d2 +"\t\t" + maxValue);
        maxValue = max(n1, d2);
        System.out.println(n1 +"\t\t" + d2 +"\t\t" + maxValue);
         maxValue = max(d1, n2);
        System.out.println(d1 +"\t\t" + n2 +"\t\t" + maxValue);
    }This is probably closer to what I need and have tried everyone's suggestions but still get compiling errors.
    public class NextOverload {
         public static void main(String[] args) {
              int n1 = 10;
              int n2 = 5;
              double d1 = 10.0;
              double d2 = 5.0;
              int result = 0;
              int k = diff (n1, n2);
              double l = diff (d1, d2);
              double m = diff (n1, d2);
              double n = diff (d1, n2);
              System.out.println("Parm1 Type\tParm2 Type\tResult");
              System.out.println(n1 +"\t\t" + n2 + "\t\t" + k);
              System.out.println(d1 +"\t\t" + d2 + "\t\t" + l);
              System.out.println(n1 +"\t\t" + d2 + "\t\t" + m);
              System.out.println(d1 +"\t\t" + n2 + "\t\t" + n);
    public static int diff(int p1, int p2) {
         int result;
         if (p1 > p2)
              result = p1 - p2;
         else
              result = p2 - p1;
         return result;
    public static double max(double p1, double p2) {
         int result;
         if (p1 > p2)
              result = p1 - p2;
         else
              result = p2 - p1;
         return result;
    public static double max(int p1, double p2) {
         int result;
         if (p1 > p2)
              result = p1 - p2;
         else
              result = p2 - p1;
         return result;
    public static double max(double p1, int p2) {
         int result;
         if (p1 > p2)
              result = p1 - p2;
         else
              result = p2 - p1;
         return result;
    }I haven't given up just quite yet but I know I am getting close, or at least it feels like I am. : )

  • Phone numbers not properly formatted

    I just upgraded to the 4S and most of my phone numbers can't be dialed by SIRI because they are not properly formatted. The numbers that can be dialed are of the form +1-617-nnn-nnnn.  The numbers that cannot be dialed are of the form nnnnnnnnnn.  I have hundreds of numbers in this format.  Any ideas?

    Have you tried Settings > General > International to make sure your phone is not set to some incorrect region which might give it trouble interpreting the numbers?

  • How do i calculate the quotient of two numbers?

    I'm working on a document in Numbers and cannot figure out how to calcate the quotient of numbers from two different columns?
    Thanks!

    "I tried doing this and I keep getting 0 or 2. There are no decimal places and I doubled check to make sure that my decimal place settings was on and it is."
    Correct.
    Re-read my post above for an explanation why this is the correct result. Both example in my table use the same dividend (8) and the same divisor (3). Both results in column C are correct for the function (QUOTIENT) or operator ( / ) used. Choose the function or operator that gives the result you expect.
    (Note: in Numbers 3, the division operator will display as ÷ )
    Also note Yvan's remarks comparing QUOTIENT and INT.
    Regards,
    Barry

  • Subtract two characters in a query

    Hi Experts,
    I want to know how to subtract two characters in a query could you please give me the solution regarding this.
    Ex: posting date - Document date
    Regards,
    Krish

    Hi,
    this can be achieved by creating two formula variables for 2 chars with replacement path and do a subtraction.
    http://www.sd-solutions.com/documents/SDS_BW_Replacement%20Path%20Variables.html
    Assign points if this is helpful...........
    Rgs,
    I.R.K

  • In I-tunes in my library music numbers appears double

    Hi,
    Since a couple of days, in I-tunes, in my Library, the music numbers appears double.
    Via homesharing, when playing the music, each number is playing two times.
    What went wrong en how can I solve the problem.
    Thanks in advance and
    Kind regards,
    Laurent

    See  >  Change your iTunes Store country
    Here  >  http://support.apple.com/kb/HT1311
    Settings > iTunes & App Stores > Apple ID: > View Apple ID > Country/Region = Change Country / Region

  • Can Pages write two numbers one over another, like atomic number and mass?

    Is it possible in Pages 08 to write two numbers right atop one another like you do for atomic number and mass number? One a bit under the line, one a little over the line, both at the same place (not one after the other)? I haven't found out how to to it.
    TIA

    Perl,
    I'm a little hesitant to post this because it's so clunky, but I don't know how desperate you are to include this notation in your work so I'll throw it out there.
    You may create a Text Box with one number over the other and insert it into your work, but it comes with a big warning. Here's an example:
    Note the following:
    o The Text Box is formatted as Floating and Object Causes Wrap is UnChecked. Warning: If you add or delete text ahead of the symbol, the registration will be lost, and if you reformat the document in any way, you may have to go looking for your symbol and move it back to where it belongs.
    o The Text in the Box is formatted as Centered
    o You will have to manually create space for the symbol in your text by using spaces, changes in line spacing or other techniques.
    This notation is pretty rare, since the Atomic Number is redundant with the Element Symbol.
    Regarding a math module, you can create an impressive variety of math notations with Grapher.app, located in your Applications > Utilities folder. When you Copy and Paste notations from Grapher, you'll have the same problems with registration, unfortunately.
    Regards,
    Jerry

  • Arggg!! How do I subtract multiple numbers in a column?

    Can anyone tell me how to subtract multiple numbers down a column in Numbers? I want to start with my figure in A2 and I want to be able to subtract the figures in cells A3 down to A19 from it, with the answer showing in A20. I'm sure this is very basic, but can't seem to make it work whatever I try
    Obviously I am a novice (to both Mac's and Spreadsheets)
    Many thanks.

    in Cell A20 type()omit the double quotes:
    "=A1-SUM(A2:A19)"

Maybe you are looking for