Results 1 to 6 of 6

Thread: Gcalctool 5.28.2

  1. #1
    Join Date
    Apr 2010
    Location
    USA - Arkansas
    Beans
    27
    Distro
    Ubuntu 12.04 Precise Pangolin

    Gcalctool 5.28.2

    38 plus 41 divided by 2 equals 58.5? Did I miss a memo? Have mathematic operations changed? Does this program not support chain calculations? I was looking for $4.71 in my checking account. This could be the problem. Anyone had anything like this happen? I ask a lot of questions don't I? Any comments appreciated.

    Thanks for any help,
    Robert

  2. #2
    Join Date
    Sep 2005
    Location
    Dallas, Tx
    Beans
    266
    Distro
    Xubuntu 12.10 Quantal Quetzal

    Re: Gcalctool 5.28.2

    Quote Originally Posted by ParadoxBlue View Post
    38 plus 41 divided by 2 equals 58.5? Did I miss a memo? Have mathematic operations changed? Does this program not support chain calculations? I was looking for $4.71 in my checking account. This could be the problem. Anyone had anything like this happen? I ask a lot of questions don't I? Any comments appreciated.

    Thanks for any help,
    Robert
    Most math engines and calculators work left to right, not through predetermined order of operations, and rely on you to set it up the right way.
    Desktop
    Antec 300 Illusion, Athlon II X4 640, 8GB DDR3 1333, EarthWatts430W, Radeon HD 6670 1GB
    Laptop
    Lenovo Thinkpad Z61T, T7200@2.00GHz, 2GB DDR2, 100gb HD, TPM Encryption

  3. #3
    Join Date
    Oct 2012
    Beans
    182

    Re: Gcalctool 5.28.2

    Quote Originally Posted by ParadoxBlue View Post
    38 plus 41 divided by 2 equals 58.5? Did I miss a memo? Have mathematic operations changed? Does this program not support chain calculations? I was looking for $4.71 in my checking account. This could be the problem. Anyone had anything like this happen? I ask a lot of questions don't I? Any comments appreciated.

    Thanks for any help,
    Robert
    This is because of operator precedence in mathematics which is then used in programming languages. multiplication and division get precedence over addition and subtraction if no parenthesis are given so in your case
    38 + 41 / 2 has become 38 + (41 / 2) which is equal to 58.5

  4. #4
    Join Date
    Sep 2005
    Location
    Dallas, Tx
    Beans
    266
    Distro
    Xubuntu 12.10 Quantal Quetzal

    Re: Gcalctool 5.28.2

    Quote Originally Posted by pkadeel View Post
    This is because of operator precedence in mathematics which is then used in programming languages. multiplication and division get precedence over addition and subtraction if no parenthesis are given so in your case
    38 + 41 / 2 has become 38 + (41 / 2) which is equal to 58.5
    +1

    PEMDAS

    Its gcalctool doing it right, and windows calculator (in basic mode) and most basic calculators doing it wrong. If you switch windows calculator to scientific mode it calculates in the same way gcalctool does.
    Desktop
    Antec 300 Illusion, Athlon II X4 640, 8GB DDR3 1333, EarthWatts430W, Radeon HD 6670 1GB
    Laptop
    Lenovo Thinkpad Z61T, T7200@2.00GHz, 2GB DDR2, 100gb HD, TPM Encryption

  5. #5
    rai4shu2 is offline Extra Foam Sugar Free Ubuntu
    Join Date
    Jun 2006
    Beans
    Hidden!
    Distro
    Xubuntu 12.04 Precise Pangolin

    Re: Gcalctool 5.28.2

    It's not so much that calculators are normally wrong as much as they normally assume that you're immediately performing some operation. For example, if you punch in 2 + 2, a normal calculator will immediately perform the operation. This is for the convenience of people doing tabulations. It looks as though Gnome Calculator is being developer-ized (that is, redesigned for the convenience of a more developer-oriented approach to doing calculations, as opposed to the way everyone else does it).

  6. #6
    Join Date
    Apr 2006
    Location
    UK
    Beans
    6,646
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Gcalctool 5.28.2

    Quote Originally Posted by pkadeel View Post
    This is because of operator precedence in mathematics
    +1
    Ask any high school student.

    Irrespective of whether programming is involved, mathematics (e.g. as used in algebra etc) has always been this way, even without use of calculators.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •