Documentation
¶
Index ¶
- Constants
- Variables
- func AddCommas(instr string) string
- func CropNStr(instr string) string
- func DumpStackFixed() []string
- func DumpStackFloat() []string
- func DumpStackGeneral() []string
- func Floor(real, places float64) float64
- func GCD(a, b int) int
- func GetRegIdx(chr byte) int
- func GetResult(s string) (float64, []string)
- func HCF(a, b int) int
- func InsertIntoByteSlice(slice, insertion []byte, index int) []byte
- func IsPrime(real float64) bool
- func MakeSubst(instr string) string
- func MapWriteAndClose()
- func NextPrimeFac(n, startfac uint) (uint, bool)
- func OutputFixedOrFloat(r float64)
- func PUSHX(R float64)
- func PWRI(R float64, I int) float64
- func PopX() float64
- func PrimeFactorMemoized(U uint) []uint
- func PushMatrixStacks()
- func READX() float64
- func RedoMatrixStacks()
- func Result(tkn tknptr.TokenType) (float64, []string)
- func Round(f float64) float64
- func STACKDN()
- func STACKROLLDN()
- func STACKUP()
- func SWAPXY()
- func SetSigFig(sf int)
- func SigFig() int
- func ToHex(L float64) string
- func UndoMatrixStacks()
- type StackType
Constants ¶
const ( X = iota // StackRegNames as int. No need for a separate type. Y Z T5 T4 T3 T2 T1 StackSize )
const Bottom = X
const HeaderDivider = "+-------------------+------------------------------+"
const LastAlteredDate = "3 Apr 2026"
const PI = math.Pi // 3.141592653589793;
const SpaceFiller = " | "
const Top = T1
Variables ¶
var CurUndoRedoIdx int
var LastX, MemReg float64
var StackRegNamesString = []string{" X", " Y", " Z", "T5", "T4", "T3", "T2", "T1"}
var StackUndoMatrix []StackType
Functions ¶
func DumpStackFixed ¶
func DumpStackFixed() []string
DumpStackFixed -- Returns a slice of stack strings in fixed point format.
func DumpStackFloat ¶
func DumpStackFloat() []string
DumpStackFloat -- returns a slice of strings that were converted from float64 to string using FormatFloat.
func DumpStackGeneral ¶
func DumpStackGeneral() []string
DumpStackGeneral -- Dumps the stack using a general format verb.
func Floor ¶
Floor -- To automatically fix the small floating point errors introduced by the conversions. Real can be negative, places cannot be negative or > 10.
func GetResult ¶
GetResult -- Input a string of commands and operations, return the result as a float64 and a message as a slice of strings.
func InsertIntoByteSlice ¶
func MapWriteAndClose ¶
func MapWriteAndClose()
func NextPrimeFac ¶
NextPrimeFac -- Returns the next prime factor after the given one. Supports the memoization algorithm. Returns true when returning a prime factor. False means there are no more prime factors.
func OutputFixedOrFloat ¶
func OutputFixedOrFloat(r float64)
OutputFixedOrFloat -- Tries to output a number without an exponent, if possible. Will output an exponent if it has to.
func PWRI ¶
PWRI -- Power function that multiplies the minimum number of times. Exponent is an int that can be negative. Power Of I. This is a power function with a real base and integer exponent, using the optimized algorithm as discussed in PIM-2, V 2.
func PrimeFactorMemoized ¶
PrimeFactorMemoized -- returns a slice of uint prime factors using a memoization algorithm.
func PushMatrixStacks ¶
func PushMatrixStacks()
PushMatrixStacks -- Saves the stack state prior to an operation that will change the stack state.
func RedoMatrixStacks ¶
func RedoMatrixStacks()
RedoMatrixStacks -- Redo the stack matrix, that is, undo the undo by reverting to a later stack state. Need to increment the pointer first, twice.
func STACKROLLDN ¶
func STACKROLLDN()
func UndoMatrixStacks ¶
func UndoMatrixStacks()
UndoMatrixStacks -- performs an undo operation by reverting to a previous stack state.