Documentation
¶
Overview ¶
Package turingmachine implements postfix calculator using a faster Turing machine.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RPNTuringMachine ¶
RPNTuringMachine returns the result of a string in reverse polish notation (postfix) by using a turing machine. The original band in the words exploded in a slice and results are hold on the band but in num form. The turing band has two copies one in string and one in float. This is mandatory to avoid multiple conversions.
A processed operation or value is erased using ? which is reserved. A calculated value is marked as num which is reserved.
An invalid sign is interpreted as a value and the next operation panics.
Example ¶
fmt.Printf("%f", RPNTuringMachine(values.RPNInput))
Output: 30.000000
Example (Exp) ¶
fmt.Printf("%.13f", RPNTuringMachine(values.Input))
Output: 3.0001220703125
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.