Documentation
¶
Overview ¶
Package operatorsnofields implements postfix calculator in one loop by editing the string containing the calculation.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RPNOperatorsNoFields ¶
RPNOperatorsNoFields returns the result of a sequence of operations written in postfix notation (reverse polish notation).
Each operation is replaced by its result until only a number is left. It fails failing if the expression is invalid. An invalid sign is interpreted as a value and the next operation panics.
The list of operators is searched using package strings. The search avoids to break a second loop but does not provide any major improvement.
Example ¶
if fmt.Print has an output (debug mode)
fmt.Printf("%f", RPNOperatorsNoFields(values.RPNInput))
Output: 30.000000
Example (Exp) ¶
fmt.Printf("%.13f", RPNOperatorsNoFields(values.Input))
Output: 3.0001220703125
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.