 |
|
 |
The 'Or' operator is bitwise or logical?
1 OR 2 = 2..... is not bitwise!
(4 > 3) OR (2 > 4) = false .... is not logical!
Where is problem? Thanks.
|
|
|
|
 |
|
 |
I actually just downloaded and added in a MAX and MIN options and fixed the bug other users where complaining about.
If I can figure out how to put up the code I will.
|
|
|
|
 |
|
|
 |
|
 |
(10/1.5)-2
gives 8.667
which should be 4.667
On division with a floating point value, it treats the - as + .
Any patch for this?
Fix before the nuclear reactors blow up!
|
|
|
|
 |
|
 |
HI
Im resolved the "substract Bug" in the Variant.cs Class
public static Variant operator -(Variant b, Variant a)
case VariantType.vtDouble:
return new Variant((double)a.oValue - (double)b.oValue);
|
|
|
|
 |
|
 |
[Variable1]-[Variable2] adds the 2 variables and does not subtract
|
|
|
|
 |
|
 |
public static Variant operator -(Variant b, Variant a)
{
switch(a.varType)
{
case VariantType.vtInt:
switch(b.varType)
{
case VariantType.vtInt:
return new Variant((int)a.oValue - (int)b.oValue);
case VariantType.vtDouble:
return new Variant((int)a.oValue - (double)b.oValue);
default:
throw(new CalcException("Bad 2-nd operand type with plus operator"));
}
case VariantType.vtDouble:
switch(b.varType)
{
case VariantType.vtInt:
return new Variant((double)a.oValue + (int)b.oValue);
case VariantType.vtDouble:
return new Variant((double)a.oValue + (double)b.oValue);
default:
throw(new CalcException("Bad 2-nd operand type with minus operator"));
}
default:
throw(new CalcException("Bad 1-st operand type with plus operator"));
}
}
o......this is bug
|
|
|
|
 |
|
 |
Sorry but this thing is really buggy
tried to enter 10.5*2 the result is 210
back to the drawing board
|
|
|
|
 |
|
 |
Please check your decimal separator in Regional Config.
This code uses decimal separator is fixed "."
Change on Parser.cs if(Char.IsNumber(c) || (c == '.'))
TO if(Char.IsNumber(c) || (c == ','))
AND while((pos < strSrc.Length) && (Char.IsDigit(strSrc[pos]) || (strSrc[pos] == '.'))) pos++;
TO while((pos < strSrc.Length) && (Char.IsDigit(strSrc[pos]) || (strSrc[pos] == ','))) pos++;
and use
10,5*2
will result 21
It works!
|
|
|
|
 |
|
 |
It seems the author can't be reached. How I can I submit an update that contains:
- A bug fix in the - operator for doubles
- Many more Math functions
- && and || support
I would attach the changes here if I could
|
|
|
|
 |
|
 |
Hi Mike,
Do you mind giving me the updated Parser ?
Thanks. My email is tonymjohn@yahoo.com
regards,
Tony John
|
|
|
|
 |
|
 |
Hi, I would like to know if you could send me your improved version of this library.
mostly Im interested on implementing Switch/Case (im using nested IIF now).
Anyway, if you havent implemented Switch/case I would like to have an improved version of this cool library
Can you email me to emiliodabdoub --at-- hotmail?
Thanks in advance
|
|
|
|
 |
|
 |
Any plans on enhancing this to allow for things like Math.Pow?
|
|
|
|
 |
|
 |
Why not making a formula parser using the C# CodeDOM parser ?
Jonathan de Halleux.
www.pelikhan.com
|
|
|
|
 |
|
 |
Great utility, but found some strange behaviour. If you pass in:
(2000.00 * 0.5) - 4
You get:
1004
And not:
996
I have overcome this by parsing input formulas and replacing "-" with "+-". This is working for the moment, but it is bound to lead to trouble.
Any help well appreciated.
Thanks, Tim.
|
|
|
|
 |
|
 |
More issues related to this :
If you are using variables, then it always treats - operator as +.
A = 10
B = 2
and [A] - [B] will give you 12 instead of 8 !!
----------------------------------------------------------------------
T John
C# Tutorials and samples : http://www.dotnetspider.com
|
|
|
|
 |
|
 |
I made a lite change in Variant.cs in overload operator - to:
case VariantType.vtDouble:
switch(b.varType)
{
case VariantType.vtInt:
//here to + for -
return new Variant((double)a.oValue - (int)b.oValue);
case VariantType.vtDouble:
//and here
return new Variant((double)a.oValue - (double)b.oValue);
default:
throw(new CalcException("Bad 2-nd operand type with minus operator"));
}
|
|
|
|
 |
|
 |
I made the change as you suggested.
However when evaluating
(([A]+[B])/[C])-[D]
it produces the result -0,10000000001 (actually -0.10000000000142 when I debugged) because of the nature of double.
Any suggestion to fix this?
Serkan
|
|
|
|
 |
|
 |
Good Job , Any plans to support And and Or operators?
Keep up great work!
|
|
|
|
 |
|
 |
This is very nice code, what are your guidelines for usage? Any copyright stuff? pm
|
|
|
|
 |
|
 |
A useful tool. The code is a bit shy on the green ink, but seems clean and well conceived at a first browse through it.
Rather than a case statement for embedded functions how about using reflection to pick the static members functions out of any provided class? This would make adding new functions dynamically quite slick.
regards,
-Blake
|
|
|
|
 |
|
 |
Blake Coverett wrote:
Rather than a case statement for embedded functions how about using reflection to pick the static members functions out of any provided class? This would make adding new functions dynamically quite slick.
I'm going to be doing something similar to this myself, so if you want the code, let me know. Also, if you'd like to help, that would be even better.
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
 |
|
 |
Hi,
I would like to know if you implemented the Case statement or something similar.
Thanks in advance
|
|
|
|
 |