Recent

Author Topic: Lazarus cannot handle simple calculations?  (Read 11837 times)

sasa

  • Guest
Re: Lazarus cannot handle simple calculations?
« Reply #15 on: August 27, 2009, 09:02:05 am »
Vincent,

You have a point, however if compiler during parsing in the future ignore the brackets if operation priority for sub-expression is the same, that will rise the problem again. Also using unlimited number of brackets in complex formulas is very hard to read if some semantic error happend... That why I suggested to OP to change all function parameter and related variable types to resulting one,.
« Last Edit: August 27, 2009, 09:30:47 am by sasa »

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 1071
Re: Lazarus cannot handle simple calculations?
« Reply #16 on: August 27, 2009, 05:01:02 pm »
I see... Thanks for clearing things out, but wouldn't it be logical, if the multiplication is evaluated using the type of variable, which is being calculated?

Additionally to what Vincent said, this is also not possible in case you have overloaded procedures. What should the compiler do with writeln(a*b*c*d*e)?

Making a special case for such situations is what makes a compiler unmaintainable and a language inconsistent and hard to understand.

Waco

  • Jr. Member
  • **
  • Posts: 61
Re: Lazarus cannot handle simple calculations?
« Reply #17 on: August 27, 2009, 10:50:20 pm »
Alright, I certainly won't argue, I know too less to do so. I just counted on the fact that all I need to do is use double as the type of resulting variable, which turned out to be a fallacy. I once again know more.

 

TinyPortal © 2005-2018