UBBFriend: Email This Page to Someone!
  uCalc Message Forums
  uCalc Tip of the Week
  Removing the requirement of a leading 0 for fractional numbers between 0 and 1

Post New Topic  Post A Reply
profile | register | preferences | faq | search

next newest topic | next oldest topic
Author Topic:   Removing the requirement of a leading 0 for fractional numbers between 0 and 1
Daniel Corbier
Administrator
posted 08-17-2007 07:59 PM     Click Here to See the Profile for Daniel Corbier     Edit/Delete Message Reply w/Quote
Removing the requirement of a leading 0 for fractional numbers between 0 and 1

Under the current settings, version 2.9 of uCalc FMP requires a leading 0 in front of fractional numbers between 0 and 1. For instance, it will recognize 0.25 as a valid number, but not .25. In the current version of uCalc FMP, nothing is set in stone. Numeric notations, syntax, and many other things can easily be modified to suit your requirements. If you do not want uCalc to require the leading 0, then simply search for the following line in the include file:

ucDefine "Pattern:[0-9]+\.)?[0-9]*(e[-+]?[0-9]+)? ~~ DataType: #2", ucLiteral, ucExtended ' Numeric

And replace it with these two pattern defs:

ucDefine "Pattern:[0-9]*(e[-+]?[0-9]+)? ~~ DataType: #2", ucLiteral, ucExtended
ucDefine "Pattern: ([0-9]+)?\.[0-9]*(e[-+]?[0-9]+)? ~~ DataType: #2", ucLiteral, ucExtended

To bookmark the most current uCalc FMP Tip of the Week, use the following link: http://www.ucalc.com/TipOfTheWeek.html

Next week's tip: How to save when purchasing uCalc

See also: Previous Tips of the Week


------------------
Daniel Corbier
uCalc FMP author

[This message has been edited by Daniel Corbier (edited 08-17-2007).]

IP: Logged

Daniel Corbier
Administrator
posted 12-20-2007 08:27 PM     Click Here to See the Profile for Daniel Corbier     Edit/Delete Message Reply w/Quote
Please note that some compilers interpret backslash \ as an escape character. So in a language like C++, you would need a double backslash \\. Also in the release of version 2.95 last week, the default data type for some compilers was changed to double precision (instead of extended). So in VC++ for instance, the second line should be:

ucDefine("Pattern: ([0-9]+)?\\.[0-9]*(e[-+]?[0-9]+)? ~~ DataType: #2", ucLiteral, ucDouble);

You do not actually have to modify the include file. If you add these two lines of definitions later on, it will supersede the definition from the include file.

------------------
Daniel Corbier
uCalc FMP author

IP: Logged

All times are Eastern Time (US)

next newest topic | next oldest topic

Administrative Options: Close Topic | Archive/Move | Delete Topic
Post New Topic  Post A Reply
Hop to:

Contact Us | uCalc

Copyright © 2000-2007 by Daniel Corbier

Powered by: Ultimate Bulletin Board, Version 5.42a
© Infopop Corporation (formerly Madrona Park, Inc.), 1998 - 1999.