module Calcium
Extended Modules
Defined in:
calcium.crcalcium/calculate.cr
calcium/exceptions.cr
calcium/formatting.cr
calcium/operators.cr
calcium/parsing.cr
calcium/tokens.cr
Constant Summary
-
OPERATORS =
{"+": {func: ->add(Array(Float64)), precedence: 1, num_args: 2, associativity: :left, prefix: false}, "-": {func: ->subtract(Array(Float64)), precedence: 1, num_args: 2, associativity: :left, prefix: false}, "*": {func: ->multiply(Array(Float64)), precedence: 2, num_args: 2, associativity: :left, prefix: false}, "/": {func: ->divide(Array(Float64)), precedence: 2, num_args: 2, associativity: :left, prefix: false}, "^": {func: ->power(Array(Float64)), precedence: 3, num_args: 2, associativity: :right, prefix: false}, "!": {func: ->factorial(Array(Float64)), precedence: 5, num_args: 1, associativity: :left, prefix: false}, "u-": {func: ->negate(Array(Float64)), precedence: 4, num_args: 1, associativity: :right, prefix: true}, sin: {func: ->(args : Array(Float64)) do Math.sin(args[0]) end, precedence: 100, num_args: 1, associativity: :left, prefix: false}, cos: {func: ->(args : Array(Float64)) do Math.cos(args[0]) end, precedence: 100, num_args: 1, associativity: :left, prefix: false}, tan: {func: ->(args : Array(Float64)) do Math.tan(args[0]) end, precedence: 100, num_args: 1, associativity: :left, prefix: false}, abs: {func: ->(args : Array(Float64)) do args[0].abs end, precedence: 100, num_args: 1, associativity: :left, prefix: false}, max: {func: ->(args : Array(Float64)) do args.max end, precedence: 100, num_args: 2, associativity: :left, prefix: false}, min: {func: ->(args : Array(Float64)) do args.min end, precedence: 100, num_args: 2, associativity: :left, prefix: false}}
-
VERSION =
{{ (`shards version \"/srv/crystaldoc.info/github-adoxography-calcium-master/src\"`).chomp.stringify }}
Instance Method Summary
- #calculate(input)
- #calculate_postfix(tokens : Array(Token))
- #format(number)
-
#parse_infix(tokens : Array(Token)) : Array(Token)
Converts an array of tokens from infix to postfix
- #tokenize(string)
Instance Method Detail
Converts an array of tokens from infix to postfix
@param Array(Calcium::Token) tokens @return Array(Calcium::Token)