emulatingstack

package
v0.0.0-...-40e32b8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 16, 2022 License: BSD-2-Clause Imports: 3 Imported by: 0

Documentation

Overview

Package emulatingstack implements postfix calculator by emulating a stack.

Original is from http://rosettacode.org/wiki/Parsing/RPN_calculator_algorithm#Go where a example of a printed output can be found. This version contains minor changes for this test.

This emulation is not using a stack in the strict sense as the structure is accessed sequentially when only pop/push operations are allowed by definition but it is the most efficient as the "stack" only contains the unused parts of the expression.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func RPNEmulatingStack

func RPNEmulatingStack(input string) float64
Example
fmt.Printf("%f", RPNEmulatingStack(values.RPNInput))
Output:
30.000000
Example (Exp)
fmt.Printf("%.13f", RPNEmulatingStack(values.Input))
Output:
3.0001220703125

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL