Arithmetic Operators Problem!

int a,b;
long c,d;
a=12345;
b=234567;
c=a*b/b;
d=(long)a*b/b;
the Result:
c= -5965
d= 12345
why ?

Please see the expression broken into smaller expressions
int a,b;
long c,d;
a=12345;
b=234567;
c=a*b/b;
int temp1 = a*b; // here we can expect lossed values in temp1
int temp2 = temp1 / b; // temp1 already corrupted
c = temp2 ;
// So instead do casting here
c = (long)a*b/b; // Good luck
d=(long)a*b/b;
the Result:
c= -5965
d= 12345
why ?

Similar Messages

  • Doubt in Basic Arithmetic Operators' behavior

    Hi all,
    The Java Language Spec says that, the arithmetic operators +(Binary additive) and ++(increment) both return a integer value.
    So, while using a code like this,
    byte a=5;
    byte b = a+1;
    The compiler throws an error which is perfectly valid. But the same should happen when we use
    a = ++a;
    But the compiler does not throw any error.
    Can anybody explain about this?
    Thanks in advance!
    Dinesh.V

    byte a=5; // No error. 5 is an int, but compiler knows that 5 fits into a byte.
    byte b = a+1; // Error. Compiler doesn't know if a + 1 will fit into a byte.
    a = ++a; // No error. Type of ++a is byte because a is a byte.b = ++a; // No error. Type of ++a is a byte because a is a byte.

  • Proper arithmetic operators

    Hi, all!
    When using the following calculation, expecting to get a percentage, I get 100 as the result for surferHappyRatio over and over. Am I missing something stupid here? The size of the 'badNeighbors' array is 1 up to 8, with null space filling out the array so that there's always 8 spaces around a Surfer.
              totalBadNeighbors = badNeighbors.size();
              float r = totalBadNeighbors / 8;
              float f = r*100;
              int surferHappyRatio = 100-((int)f);
              System.out.println("==> happyRatio successfully calculated at " + surferHappyRatio);
              

    Learn to do some basic debugging:
    totalBadNeighbors = badNeighbors.size();
    System.out.println( totalBadNeighbors );
    float r = totalBadNeighbors / 8;
    System.out.println( r );
    float f = r*100;
    System.out.println( f );
    int surferHappyRatio = 100-((int)f);
    System.out.println("==> happyRatio successfully
    calculated at " + surferHappyRatio);What good does it do to only print out the final
    value if you don't know what the indermediate results
    are?I deserved that--I should have told you all that I already tried some debugging and just didn't show you that. Here's the problem (I'm channeling Adrian Monk): the answer to System.out.println( totalBadNeighbors ) was 3 in the test case. Obviously, I should get 0.375 as the answer to System.out.println( f ), but I'm not. I believe I've properly cast the variables--what in heaven's name am I missing? float/float = float, right?

  • Arithmetic operators

    Hi experts,
    I need this : I have my variable num_pack = 0,04 type i.
                       I need my variable becomes 1.
                       Which operator do I need ( if exists ) ?
    Thanks in advance.
    Marco

    you have to call a function module to round always up.
    I dont remeber the exact name
    go SE37 and search for it by entering  round and hit F4.

  • Arithmetic Operators Help

    I've just started my Java programming class, and my book is not in from Amazon yet. So, please let me know if I recall these correctly from a previous Introduction to Java class from a fews years ago.
    The value of 5/2: 2
    The value of 5.0/2: 2.5
    The value of 5%2: 1
    The value of 2%5: 2
    Thanks for your help!

    You don't need a book or our help here. Just download the java compiler, read the first few tutorials to get it up and running and run a small program to see if your expectations match your findings. This is the best way to discover programming.

  • Cannot view arithmetic operators in Preview

    I can't seem to view this math related document correctly:
    "http://www.stewartcalculus.com/data/default/upfiles/LiesCalcAndCompTold.pdf".
    Message was edited by: Pleasehelp05

    I don't know why it does not work in Leopard, when it worked OK in Tiger.
    For the Adobe Reader issue with installation, you may want to run +Repair Disk Permissions+ in Disk Utility if you have not done that recently. Then, try it again.

  • What am I doing wrong. I have problem with operators

    I have problem with following code. I am trying to use the operators in the array but I can't make it work.
    The result of the program commes up:
    58
    60
    57
    The correct result should be:
    15
    -5
    50
    What am I doing wrong?
    class Operators{
         public void operators (){              
              char [] operator = {'+','-','*'};
              int a = 5;
              int b = 10;
              for (int i=0; i<3;i++){              
                   int c = a+operator[i]+b;
                   System.out.println(c);          
         public static void main (String[] args){
    Operators op = new Operators();
    op.operators();

    Sorry to confuse you. When I have posted the first message I tried to simplify the problem. By doing this thought that I could figure out the rest of the problem by myself. But instead of getting answers I got more confused. What I am trying to do am:
    To take six or more numbers and put operators between numbers and display the result. I need to display the results for all possible operator combinations between the numbers.
    For example if I take six numbers 10,20,30,40,50,60 and I put the arithmetic operators in between the numbers I would like to create all possible results operator combinations and what the result would be.
    10+20+30+40+50+60 = 210
    10+20+30+40+50-60 = 90
    10+20+30+40+50*60 = 3150

  • Basic java problem..

    need this program to show each category individually...cant do it at all..been at it a week....must be the && and || signs...i think...plz can someone help me as im really stuck now...thank you so much..
    import java.util.Scanner;
    public class assignmentquestion3 {
    public static Scanner key=new Scanner(System.in);
    public static void main(String []args){
    int fullfee=800,newfullfee=3800,associatefee=200,newla diesfee= 2350,ladiesfee= 350,under18fee = 175;
    int selectcat=0;
    int reply = 0;
    int addmember=0;
    int currentfulltotalmem=0,newfulltotalmem=0,associatet otalmem=0,ladiestotalmem=0,under18totalmem=0;
    int assoctotalcash=0,ladiestotalcash=0,under18totalcas h=0;
    int fullprepay=150;
    int ladiesfull=2500;
    int completefull = 0;
    int ladiescurrent=500;
    int under18=175;
    //Main introduction screen for the user and selections available. do while loops only allowing numbers 1,2,3 or 4.
    do{
    do{
    System.out.printf("\n\t %90s","********************Membership Rates For The Golf Club********************");
    System.out.printf("\n\n %105s","This program will allow users to enter details of members as well as calculating and.");
    System.out.printf("\n%106s","outputing the total amount each member should pay. The program allows users to view the");
    System.out.printf("\n%106s","total number of members in each category and the total income for each category.");
    System.out.printf("\n\n\t %75s","Please select your membership category: ");
    System.out.printf("\n\n\t %68s","Please press '1' for FULL");
    System.out.printf("\n\n\t %68s","Please press '2' for ASSOCIATE");
    System.out.printf("\n\n\t %68s","Please press '3' for LADIES");
    System.out.printf("\n\n\t %68s","Please press '4' for UNDER 18");
    System.out.printf("\n\n\t %68s","Please enter 1,2,3 or 4: ");
    selectcat=key.nextInt();
    }while (selectcat>4 || selectcat<1);
    do{
    System.out.printf("\n\n\t %75s","Are you a Current Member (press 1) or a New Member (press 2): ");
    reply=key.nextInt();
    }while (reply<1 || reply>2);
    //if number '1' for 'FULL' category is selected by the user and reply is 'yes'(1) then new full member fee is shown to user
    if (selectcat==1 ||reply==1)
    System.out.printf("\n\n\t %68s","CURRENT FULL MEMBERSHIP SELECTED");
    System.out.printf("\n\n\t %68s","Current full membership fees yearly are £"+fullfee+"");
    System.out.printf("\n\n\t %68s","Full members must also pre-pay £"+fullprepay+" on a card can be used in the club facilities such as bar and shop ");
    System.out.printf("\n\n\t %72s","The total of this membership is: £"+fullfee+"");
    currentfulltotalmem=currentfulltotalmem+1;
    System.out.printf("\n\n\t %72s","The total number of 'CURRENT FULL MEMBERSHIPS = "+currentfulltotalmem+"");
    completefull=completefull+fullfee;
    System.out.printf("\n\n\t %68s","The total amount of income for 'FULL MEMBERSHIPS' within the club = £"+completefull+"");
    //if number '1' is selected by the user and reply is 'no' (2) then full member fee is shown to user
    else if (selectcat==1 &&reply==2)
    System.out.printf("\n\n\t %68s","NEW FULL MEMBERSHIP SELECTED");
    System.out.printf("\n\n\t %68s","Full membership fees yearly are £"+newfullfee+"");
    newfulltotalmem=newfulltotalmem+1;
    System.out.printf("\n\n\t %68s","The total number of 'NEW FULL MEMBERSHIPS = "+newfulltotalmem+"");
    completefull=completefull+newfullfee;
    System.out.printf("\n\n\t %68s","The total amount of income for 'FULL MEMBERSHIPS' within the club = £"+completefull+"");
    //if number '2' is selected by the user then associate member fee is shown to user
    if (selectcat==2 &&(reply==1 || reply==2))
    System.out.printf("\n\n\t %75s","ASSOCIATE MEMBERSHIP SELECTED");
    System.out.printf("\n\n\t %75s","ASSOCIATE membership fees yearly are £"+associatefee+"");
    associatetotalmem=associatetotalmem+1;
    System.out.printf("\n\n\t %75s","The total number of 'ASSOCIATE MEMBERSHIPS' WITHIN THE CLUB = "+associatetotalmem+"");
    assoctotalcash=assoctotalcash+associatefee;
    System.out.printf("\n\n\t %68s","The total amount of income for 'ASSOCIATE MEMBERSHIPS' within the club = £"+assoctotalcash+"");
    //if number '3' is selected by the user and reply is 'yes' then new ladies member fee is shown to user
    if (selectcat==3 &&reply==1)
    System.out.printf("\n\n\t %68s","LADIES CURRENT MEMBERSHIP SELECTED");
    System.out.printf("\n\n\t %68s","Ladies full membership fees yearly are £"+ladiesfee+"");
    System.out.printf("\n\n\t %68s","Ladies must also pre-pay £"+fullprepay+" on a card can be used in the club facilities such as bar and shop ");
    System.out.printf("\n\n\t %68s","The total of this membership is: £"+ladiescurrent+"");
    ladiestotalmem=ladiestotalmem+1;
    System.out.printf("\n\n\t %75s","The total number of 'LADIES MEMBERSHIPS' WITHIN THE CLUB = "+ladiestotalmem+"");
    ladiestotalcash=ladiestotalcash+ladiescurrent;
    System.out.printf("\n\n\t %68s","The total amount of income for 'LADIES MEMBERSHIPS' within the club = £"+ladiestotalcash+"");
    //if number '3' is selected by the user and reply is 'no' then the current ladies member fee is shown to user
    else
    if (selectcat==3 && reply==2)
    System.out.printf("\n\n\t %68s","LADIES NEW MEMBERSHIP SELECTED");
    System.out.printf("\n\n\t %68s","LADIES NEW MEMBERSHIP fees yearly are £"+newladiesfee+"");
    System.out.printf("\n\n\t %68s","Ladies must also pre-pay £"+fullprepay+" on a card can be used in the club facilities such as bar and shop ");
    System.out.printf("\n\n\t %68s","The total of this membership is: £"+ladiesfull+"");
    ladiestotalmem=ladiestotalmem+1;
    System.out.printf("\n\n\t %75s","The total number of 'LADIES MEMBERSHIPS' within the club = "+ladiestotalmem+"");
    ladiestotalcash=ladiestotalcash+ladiesfull;
    System.out.printf("\n\n\t %68s","The total amount of income for 'LADIES MEMBERSHIPS' within the club = £"+ladiestotalcash+"");
    //if number '4' is selected by the user then under 18 member fee is shown to user
    else if (selectcat==4 &&(reply==1||reply==2))
    System.out.printf("\n\n\t %75s","UNDER 18 MEMBERSHIP SELECTED");
    System.out.printf("\n\n\t %75s","UNDER 18 yearly membership fees are £"+under18fee+"");}
    System.out.printf("\n\n\t %68s","The total of this membership is: £"+under18+"");
    under18totalmem=under18totalmem+1;
    System.out.printf("\n\n\t %75s","The total number of 'UNDER 18 MEMBERSHIPS' within the club = "+under18totalmem+"");
    under18totalcash=under18totalcash+under18;
    System.out.printf("\n\n\t %68s","The total amount of income for 'UNDER 18 MEMBERSHIPS' within the club = £"+under18totalcash+"");
    //allowing user to select '0' to add another member or any other key to exit program
    System.out.printf("\n\n\t %68s","Please Press '0' to add another member or any other key to exit.: ");
    addmember=key.nextInt();
    }while (addmember==0 ||addmember>1);}}
    //

    im so sorry guys for not showing my code problems first to...
    the problem is :
    to produce a program which will show membership rates for a golf club..
    membership yearly rate new member joining fee
    category
    full 650 3000
    associate 200
    ladies 350 2000
    under 18 175
    new members must pay a joining fee in addition to the yearly rate as shown
    full/ladies members also prepay £150
    write a program which will enter details of members,calculate and output the total amount each member should pay.
    output number of members in each category
    the total income for each category....
    the problem im having is whenever i make the choices 1,2,3,4 (CATEgorys) AND hit 1 or 2(current or new member selections) it brings up more than one category...
    for example when i hit 1(Category full) and 1(current member)..it displays this:
    Are you a Current Member (press 1) or a New Member (press 2): 1
    CURRENT FULL MEMBERSHIP SELECTED
    Current full membership fees yearly are £800
    Full members must also pre-pay £150 on a card can be used in the club facilities such as bar and shop
    The total of this membership is: £800
    The total number of 'CURRENT FULL MEMBERSHIPS = 1
    The total amount of income for 'FULL MEMBERSHIPS' within the club = £800
    The total of this membership is: £175
    The total number of 'UNDER 18 MEMBERSHIPS' within the club = 1
    The total amount of income for 'UNDER 18 MEMBERSHIPS' within the club = £175
    Please Press '0' to add another member or any other key to exit.:
    under 18 membership as well?...does this for other selections too...is it my arithmetic operators?....my if loops?...

  • Basic java problem help needed please

    the problem is :
    to produce a program which will show membership rates for a golf club..
    membership yearly rate new member joining fee
    category
    full 650 3000
    associate 200
    ladies 350 2000
    under 18 175
    new members must pay a joining fee in addition to the yearly rate as shown
    full/ladies members also prepay 150
    write a program which will enter details of members,calculate and output the total amount each member should pay.
    output number of members in each category
    the total income for each category....
    i need this program to show each category individually...cant do it at all..been at it a week....must be me && and || signs...i think...plz can someone help me as im really stuck now...thank you so much..
    import java.util.Scanner;
    public class assignmentquestion3 {
    public static Scanner key=new Scanner(System.in);
    public static void main(String []args){
    int fullfee=800,newfullfee=3800,associatefee=200,newla diesfee= 2350,ladiesfee= 350,under18fee = 175;
    int selectcat=0;
    int reply = 0;
    int addmember=0;
    int currentfulltotalmem=0,newfulltotalmem=0,associatet otalmem=0,ladiestotalmem=0,under18totalmem=0;
    int assoctotalcash=0,ladiestotalcash=0,under18totalcas h=0;
    int fullprepay=150;
    int ladiesfull=2500;
    int completefull = 0;
    int ladiescurrent=500;
    int under18=175;
    //Main introduction screen for the user and selections available. do while loops only allowing numbers 1,2,3 or 4.
    do{
    do{
    System.out.printf("\n\t %90s","********************Membership Rates For The Golf Club********************");
    System.out.printf("\n\n %105s","This program will allow users to enter details of members as well as calculating and.");
    System.out.printf("\n%106s","outputing the total amount each member should pay. The program allows users to view the");
    System.out.printf("\n%106s","total number of members in each category and the total income for each category.");
    System.out.printf("\n\n\t %75s","Please select your membership category: ");
    System.out.printf("\n\n\t %68s","Please press '1' for FULL");
    System.out.printf("\n\n\t %68s","Please press '2' for ASSOCIATE");
    System.out.printf("\n\n\t %68s","Please press '3' for LADIES");
    System.out.printf("\n\n\t %68s","Please press '4' for UNDER 18");
    System.out.printf("\n\n\t %68s","Please enter 1,2,3 or 4: ");
    selectcat=key.nextInt();
    }while (selectcat>4 || selectcat<1);
    do{
    System.out.printf("\n\n\t %75s","Are you a Current Member (press 1) or a New Member (press 2): ");
    reply=key.nextInt();
    }while (reply<1 || reply>2);
    //if number '1' for 'FULL' category is selected by the user and reply is 'yes'(1) then new full member fee is shown to user
    if (selectcat==1 ||reply==1)
    System.out.printf("\n\n\t %68s","CURRENT FULL MEMBERSHIP SELECTED");
    System.out.printf("\n\n\t %68s","Current full membership fees yearly are "+fullfee+"");
    System.out.printf("\n\n\t %68s","Full members must also pre-pay "+fullprepay+" on a card can be used in the club facilities such as bar and shop ");
    System.out.printf("\n\n\t %72s","The total of this membership is: "+fullfee+"");
    currentfulltotalmem=currentfulltotalmem+1;
    System.out.printf("\n\n\t %72s","The total number of 'CURRENT FULL MEMBERSHIPS = "+currentfulltotalmem+"");
    completefull=completefull+fullfee;
    System.out.printf("\n\n\t %68s","The total amount of income for 'FULL MEMBERSHIPS' within the club = "+completefull+"");
    //if number '1' is selected by the user and reply is 'no' (2) then full member fee is shown to user
    else if (selectcat==1 &&reply==2)
    System.out.printf("\n\n\t %68s","NEW FULL MEMBERSHIP SELECTED");
    System.out.printf("\n\n\t %68s","Full membership fees yearly are "+newfullfee+"");
    newfulltotalmem=newfulltotalmem+1;
    System.out.printf("\n\n\t %68s","The total number of 'NEW FULL MEMBERSHIPS = "+newfulltotalmem+"");
    completefull=completefull+newfullfee;
    System.out.printf("\n\n\t %68s","The total amount of income for 'FULL MEMBERSHIPS' within the club = "+completefull+"");
    //if number '2' is selected by the user then associate member fee is shown to user
    if (selectcat==2 &&(reply==1 || reply==2))
    System.out.printf("\n\n\t %75s","ASSOCIATE MEMBERSHIP SELECTED");
    System.out.printf("\n\n\t %75s","ASSOCIATE membership fees yearly are "+associatefee+"");
    associatetotalmem=associatetotalmem+1;
    System.out.printf("\n\n\t %75s","The total number of 'ASSOCIATE MEMBERSHIPS' WITHIN THE CLUB = "+associatetotalmem+"");
    assoctotalcash=assoctotalcash+associatefee;
    System.out.printf("\n\n\t %68s","The total amount of income for 'ASSOCIATE MEMBERSHIPS' within the club = "+assoctotalcash+"");
    //if number '3' is selected by the user and reply is 'yes' then new ladies member fee is shown to user
    if (selectcat==3 &&reply==1)
    System.out.printf("\n\n\t %68s","LADIES CURRENT MEMBERSHIP SELECTED");
    System.out.printf("\n\n\t %68s","Ladies full membership fees yearly are "+ladiesfee+"");
    System.out.printf("\n\n\t %68s","Ladies must also pre-pay "+fullprepay+" on a card can be used in the club facilities such as bar and shop ");
    System.out.printf("\n\n\t %68s","The total of this membership is: "+ladiescurrent+"");
    ladiestotalmem=ladiestotalmem+1;
    System.out.printf("\n\n\t %75s","The total number of 'LADIES MEMBERSHIPS' WITHIN THE CLUB = "+ladiestotalmem+"");
    ladiestotalcash=ladiestotalcash+ladiescurrent;
    System.out.printf("\n\n\t %68s","The total amount of income for 'LADIES MEMBERSHIPS' within the club = "+ladiestotalcash+"");
    //if number '3' is selected by the user and reply is 'no' then the current ladies member fee is shown to user
    else
    if (selectcat==3 && reply==2)
    System.out.printf("\n\n\t %68s","LADIES NEW MEMBERSHIP SELECTED");
    System.out.printf("\n\n\t %68s","LADIES NEW MEMBERSHIP fees yearly are "+newladiesfee+"");
    System.out.printf("\n\n\t %68s","Ladies must also pre-pay "+fullprepay+" on a card can be used in the club facilities such as bar and shop ");
    System.out.printf("\n\n\t %68s","The total of this membership is: "+ladiesfull+"");
    ladiestotalmem=ladiestotalmem+1;
    System.out.printf("\n\n\t %75s","The total number of 'LADIES MEMBERSHIPS' within the club = "+ladiestotalmem+"");
    ladiestotalcash=ladiestotalcash+ladiesfull;
    System.out.printf("\n\n\t %68s","The total amount of income for 'LADIES MEMBERSHIPS' within the club = "+ladiestotalcash+"");
    //if number '4' is selected by the user then under 18 member fee is shown to user
    else if (selectcat==4 &&(reply==1||reply==2))
    System.out.printf("\n\n\t %75s","UNDER 18 MEMBERSHIP SELECTED");
    System.out.printf("\n\n\t %75s","UNDER 18 yearly membership fees are "+under18fee+"");}
    System.out.printf("\n\n\t %68s","The total of this membership is: "+under18+"");
    under18totalmem=under18totalmem+1;
    System.out.printf("\n\n\t %75s","The total number of 'UNDER 18 MEMBERSHIPS' within the club = "+under18totalmem+"");
    under18totalcash=under18totalcash+under18;
    System.out.printf("\n\n\t %68s","The total amount of income for 'UNDER 18 MEMBERSHIPS' within the club = "+under18totalcash+"");
    //allowing user to select '0' to add another member or any other key to exit program
    System.out.printf("\n\n\t %68s","Please Press '0' to add another member or any other key to exit.: ");
    addmember=key.nextInt();
    }while (addmember==0 ||addmember>1);}}
    the problem im having is whenever i make the choices 1,2,3,4 (CATEgorys) AND hit 1 or 2(current or new member selections) it brings up more than one category...
    for example when i hit 1(Category full) and 1(current member)..it displays this:
    Are you a Current Member (press 1) or a New Member (press 2): 1
    CURRENT FULL MEMBERSHIP SELECTED
    Current full membership fees yearly are 800
    Full members must also pre-pay 150 on a card can be used in the club facilities such as bar and shop
    The total of this membership is: 800
    The total number of 'CURRENT FULL MEMBERSHIPS = 1
    The total amount of income for 'FULL MEMBERSHIPS' within the club = 800
    The total of this membership is: 175
    The total number of 'UNDER 18 MEMBERSHIPS' within the club = 1
    The total amount of income for 'UNDER 18 MEMBERSHIPS' within the club = 175
    Please Press '0' to add another member or any other key to exit.:
    under 18 membership as well?...does this for other selections too...is it my arithmetic operators?....my if loops?...

    Multi-post [http://forums.sun.com/thread.jspa?threadID=5346248&messageID=10498270#10498270]
    And it still doesn't compile.

  • Not showing error in dual while using it as arithmetic expression

    Hi,
    I have a requirement to throw error if two consecutive numbers or two consecutive operators are given. For this I would like to use dual table.
    It is throwing error if two numbers are given, but not throwing error if it has two operators.
    Error thrown for -> select 2 4 - 7 from dual;
    Error not thrown for -> select 2 + - 7 from dual;
    or
    select 2 - + 7 from dual;
    I am expecting an error in later case too. Can we do any changes to the query to throw the error?
    Thanks!

    Hi,
    If str is a string, then this expression
    REGEXP_LIKE ( str
             , '(\d\s+\d)'     || -- digits, separated by 1 or more whitespace characters
               '|'          || -- or
               '([+*/-]\s*[+*/-]'   -- operators, separated by 0 or more whitespace characters
             )will return TRUE if (and only if) str contains either two consecutive digits (separated by at least 1 space character) or str contains two consectuive arithmetic operators (not necessaily separated by space characters).
    You can include other operator symbols, by including them in both of the lists enclosed in square brackets. The hyphen ('-') must be the very first character or the very last character in the list; aside from that, the order of the symbols makes no difference.
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and also post the results you want from that data.
    Explain, using specific examples, how you get those results from that data.
    Always say which version of Oracle you're using.
    See the forum FAQ {message:id=9360002}

  • Problem Adding Calculations to Currency Formated Cells

    I have a cell that is formated in currency (USD in this case, i.e. $1,000) and I want to add a calculation to that cell. I double click on the cell with the $1,000, put the cursor at the begining of the cell (before the $) and push "=". A forumula rounded box with a X and √ appears. I type in "+500". Now what shows is "=$1,000+500". I push return and get a syntax error! I now have to go back and delete the comma and the $. Yuck.
    It's even worse, if you have a cell with $10 in it. Then the above process thinks it referencing row 10!
    Excel handles this issue seamlessly.
    Any ideas? Is this a bug?

    Numbers is not MS Excel, and MS Excel is not Numbers. Each application has features that are not supported by the other.
    Not a bug, although it does appear to be a not-well-thought-out feature.
    The issue is that once the $ is in the entry box, the whole "$1,000" is perceived (within that cell) as a text string. Any formula using one of the arithmetic operators will choke on text.
    The second use of the $ sign is as the absolute reference operator. If it preceded a number equal to or smaller than the largest row number on the table, the combination will be interpreted in a formula as an absolute reference to that row, or to the cell in that row in the same column as the formula; whichever better fits the reference in that formula.
    Either way, you're not going to get the result you want, and you are likely to get a syntax error message.
    OTOH, in a cell where the fixed number has been entered as the result of an equation (eg. =1000), formatting the cell as currency will change the displayed value, but not the value as it appears in the entry box. Neither the $ sign nor the thousands separator (,) will appear, you will be able to append "+500" (without the quotes) to the end of the formula, and you will get the expected result ( $1,500) displayed in the cell. And, as the formula itself contains NO $, the issue of 10 being recognized as a row reference will not arise.
    For my own use, I'd simply avoid the currency format except for summary cells. A column containing a list of numerical values (with two places after the decimal) is easily recognized as a list of currency amounts, even without to $ sign. The same list with the sign applied to every value is cluttered, and more difficult to read.
    Regards,
    Barry
    PS: If you want this feature changed in a future edition of Numbers, your best route is to Provide Numbers Feedback, using the menu item of that name in the Application menu (in Numbers, the "Numbers" menu). The link will also take you to the feedback page.

  • Add spaces in arithmetic expressions

    Hi experts,
    i have to insert spaces in arithmetical expressions written by users.
    For example:
    INPUT (by USERS): A+B-SQRT(C)/(D**2)
    OUTPUT (by Program): A + B - SQRT( C ) / ( D ** 2 )
    Possible arithmetic operators are:
    +; - ; *; /; **; SQRT()
    Any hints will be rewarded.
    Thanks in advance.
    Fabio.

    Thanks to all guys!
    the right code is a mixt of yours hints:
      l_len = STRLEN( tb_mzcatc-/bic/zformatc ).
      DO.
        l_char = input+n(1).
        CASE l_char.
          WHEN 'Q' OR
               'R'.
            CONCATENATE formula l_char INTO formula.
          WHEN 'T'.
            l_char = input+n(2).
            CONCATENATE formula l_char INTO formula.
            n = n + 1.
          WHEN '*'.
            IF input+n(2) = '**'.
              l_char = input+n(2).
              CONCATENATE formula l_char INTO formula SEPARATED BY ' '.
              n = n + 1.
            ELSE.
              CONCATENATE formula l_char INTO formula SEPARATED BY ' '.
            ENDIF.
          WHEN OTHERS.
            CONCATENATE formula l_char INTO formula SEPARATED BY ' '.
        ENDCASE.
        n = n + 1.
        IF n GT l_len.
          EXIT.
        ENDIF.
      ENDDO.
    Message was edited by:
            Fabio Cappabianca

  • Find the arithmetic operator

    Hi,
    My Document lot of mathematical equations. So i have applied the character style arithmetic operators but can't find the "+"
    app.findGrepPreferences.findWhat = "+";
    And also i tried this method i got that result("−") but i cant find the ("+")
    var test = String.fromCharCode(8722);
    app.findGrepPreferences.findWhat = test ;
    Any one help me
    Regards,
    Balaji B.

    Simplest is instead of using
    findGrepPreferences.findWhat
    use
    findTextPreferences.findWhat
    The point is that + is a GREP symbol (meaning one or more times).
    So if you really must use GREP, you have to escape it with a backslash
    (and that backslash has to be escaped as well if you're scripting it):
    findGrepPreferences.findWhat = "\\+";
    But again, just use textPreferences unless you have to use the extra
    power of GREP

  • Perform multiplication, division n get remainder without using arithmetic o

    hello,
    perform multiplication, division n get remainder without using arithmetic operators
    thanks in advance
    manasi

    ram.manasi wrote:
    i can program myself however i am new to programming and have no clue how to perform arithmmetic operations without using arithmetic operators n would like to know how to go about itwell, we're not your private code-monkeys nor are we tutors. We are usually best at answering specific questions but many of us get our hackles up when someone simply demands an answer. I suggest that you find out what your teacher is expecting of you here. I would guess that this involves some recursion, but it is up to you to find out. Do some work. Then if you have a specific question, please feel free to come back and ask for help. nicely.

  • Arithmetic operator

    Can't you use all Arithmetic operators with characters?

    What would the value be of doing this, evenassuming
    you can?it's easy:
    2 * '.' == ':'
    't' - '-' == l
    '~' + 'o' == � (that's &otilde; in
    html)
    'p' ^ -1 == 'd'
    sqrt('A') == 'a'
    and so on...And if code were written like that, it would be time to get a rope to have a hangin' for the coder...

Maybe you are looking for

  • Load balance traffic to a service based on a added field in the HTTP Header

    I am trying to use HTTP Header Load balancing but the field we want to use in order to load balance is "user-defined", example HTTP_TOTO = toto1. Do you have any idea on how I could perform this ? Thanks in advance

  • "On" button works intermittently

    I have to press the "On" button located at the top right of the screen on my HP Split several time before I get a response. It will eventually work, but sometimes I have to press it five or six times. It doesn't seem to make a difference whether I'm

  • How to minimise side effects of any note / Patch Application

    How can one know that what effect a note / Patch is going to have and what all transaction codes it will hit.. For example i applied one note which seems to have activated a certain schema which was earlier commented out in the system. resulting in t

  • What is happening to my e-mails?

    Hi all, this is not a regular occurrence (it happened only twice now), but is very annoying. I received an e-mail, after moving it into my Mailbox the text and attachment dissapeared and changed into something like this: --Apple-Mail=_7E0AC45.... Con

  • Premier Pro Help !!

    Hi Guys there is two bars at the top of the frame except one which for some reason does not open HMMMM Eg I want to be able to have the three bars back again and move my clips freely adjusting the size etc Please Help Regards George