It appears (from the grammar supplied in the source) and bitter experience that the NetAdvantage for WinForms v5.3 control does not accept numbers of the form 1.4e-10. Is this corrected in later versions of the control?
Thanks in advance,
Dave
Hi Dave,
I doubt it. I'm pretty sure that the CalcManager does something like double.TryParse to get the value into a numeric value and double.Parse won't recognize exponential notation, either.
But why use a string to represent a numeric value in a formula? Where is this string coming from?
Hi Mike.
Thanks for the quick reply and apologies for my late one - I have been away over the holiday period :)
I am not using the calc manager on a form, I am using the Calculate method to calculate a formula held in a string; the formula parser only recognises 0-9[.0-9] as a double number in this case - I was just expecting it to be a bit smarter than that, that's all.
Cheers,
Thanks, Mike. I have submitted a feature request.
Good info there.
I encourage you to Submit a feature request to Infragistics and include all of this info, and perhaps we can add exponent support in a future release.
Hi Mike,
Thanks once again for your reply. I have three points for you:
1) In .Net 2.0, Double.TryParse has an overload that allows many variants to be parsed, including exponents. (Check out ms-help://MS.VSCC.v90/MS.MSDNQTR.v90.en/fxref_mscorlib/html/d0ccec4d-01a1-6527-22a0-7a3473451a56.htm in VS2008)
2) I am talking about double constants in formulae. If you want to see an example failure, try to bind this formula to a wingrid column (I used the "formula builder at run time" example):
if(abs( [Int32 1] - [Int32 2] )) > 1e-6, "bigger", "equal")
[It doesn't make sense, as the referenced columns are integers but it shows the problem]
3) This issue occurs because the parser defined in winforms\wincalcmanager\ultracalcengine\Compiler\formula.grammar only defines a constant number without specifying an optional exponent.
I hope this makes sense.
Cheers,Dave
Well, we try not to re-invent the wheel if we don't have to. double.TryParse is the way the DotNet Framework does it. If there's a parser in the framework that interprets exponential notation, then that would be very easy for us to use, but I am not aware of any.