# Quick Algebra Syntax for working with numbers

Registered by edA-qa

Currently the "binOp" function is available for working with numbers, though it is kind of bulky and doesn't easily allow for using multiple expressions. A more natural algebraic expression is requried.

## Blueprint information

Status:
Not started
Approver:
None
Priority:
Undefined
Drafter:
None
Direction:
Needs approval
Assignee:
None
Definition:
Drafting
Series goal:
None
Implementation:
Unknown
Milestone target:
None

### Whiteboard

I propose using (= as an opening operator. This is a natural extension of the function syntax.

set %Value% (= %A% * %B% + log( %C% ) )

The (= must be paren balanced, and inner parens follow normal algebra rules. To not overload the parser the entire inner expression will just be passed on to a function. In this respect this need not even have special support. The parameter here can simply be unparsed (like noParse) and the = accepted as a special function name (make a shortcut for function name "expr" maybe). This form should be accpeted with and without a space following the = sign (to not annoy the user)

Though a short-cut for variables could be allowed we'll leave the % notation for consistency.

The language should have several common functions but need not allow a user extension mechanism. The common functions:
+ - / * ^
floor ceil round mod* abs
log //only natural log, for the rare case a user needs logX they can use the form log N / log X )
sqrt //only simple sqrt, for other roots the user can simlpy use power notation N ^ (1/R) )

*use the C definition of fmod for mod.

TBD: The *BIG* question here is whether to use a fixed scale BigDecimal calculation or to use floating point. "log" is not defined for BigDecimal, and mod has a different definition (but a new one can simply be written). Float will have the surprise when testing financial websites (more likely than science) that values aren't rounding as expected. I'm tempted to do like binOp and just use a 1024 scale BigDecimal. If floating point is needed perhaps a special notation for that mode. (f= or perhaps also a 5 digit rounding method for finance (\$=

Update: Refer to below URL for log method on BigDecimal
http://stackoverflow.com/questions/739532/logarithm-of-a-bigdecimal

(?)

### Work Items

This blueprint contains Public information
Everyone can see this information.

No subscribers.