Home | Blog | Software | Reviews and Features | Forum | Help | Donate | About us
topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • December 10, 2016, 04:56:41 AM
  • Proudly celebrating 10 years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: [FCalc] Variable increment bug  (Read 3163 times)

d4ni

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 129
    • View Profile
    • Donate to Member
[FCalc] Variable increment bug
« on: January 19, 2009, 10:27:52 AM »
Hi mouser,

I believe I have identified a (pretty obvious) bug while incrementing a variable which has been created using FCalc. If I want to add 1 to a variable x, is there any other way than using fc x = x+1 or fc x = (x+1)? The += operator is not supported I noticed, so I figured this was the way to go. However, the variable x actually gets the value x+2.

To reproduce:
1. Launch FCalc using its regex
2. Type 'x = 0'
3. Type 'x = (x+1)'
4. Type 'x' to see the result.

The result is supposed to be 1, but instead is 2. This happens all the time.

I think part of the bug is the fact you can alter variables *without* pressing the enter key. For example, I can type:
1. 'x = 0' [ENTER]
2. 'x = 5' // But then remove the line using backspace, perhaps I made an error. I *did not* press [ENTER] here.

Now, however, x *did* in fact change to 5. Which, imho, it should *not* do.

::important edit

It seems if I want to increment integer x with the constant n using the notation x = (x+n), it is somehow parsed to x = x + 2n. In the case of incrementing by 1, this results in an increment by 2. If I increment by 10, however, x will be incremented by 20 instead.
« Last Edit: January 19, 2009, 10:30:17 AM by d4ni »

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 36,434
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: [FCalc] Variable increment bug
« Reply #1 on: January 19, 2009, 02:33:15 PM »
you are right! wow that's weird. i'll fix.
however i might point you to jscalc by czb which is a newer calculator plugin for farr with some additional very cool features.

d4ni

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 129
    • View Profile
    • Donate to Member
Re: [FCalc] Variable increment bug
« Reply #2 on: January 19, 2009, 05:41:07 PM »
Ofcourse I'm right ;) j/k

I just checked jscalc out for a bit and it certainly is nice, thanks for the tip. It actually does support +=, *= and /=, sweet!

d4ni

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 129
    • View Profile
    • Donate to Member
Re: [FCalc] Variable increment bug
« Reply #3 on: August 14, 2009, 04:28:16 PM »
Just a heads up, I noticed the bug is still around ;)