Documentation ¶
Overview ¶
Package calc enter string equations to implement numeric arithmetic
Index ¶
Examples ¶
Constants ¶
View Source
const CalcAccuracy int8 = 7
Variables ¶
This section is empty.
Functions ¶
func FloatSimple ¶
FloatSimple Floating-point number string beautification
func NumberClear ¶
NumberClear number string clear like '_' or ','
func NumberSplitFormat ¶
NumberSplitFormat numeric value segmentation and beautification
func StringAsFloat ¶
func StringAsI64 ¶
Types ¶
type Calc ¶
type Calc struct { Accuracy int8 // contains filtered or unexported fields }
Calc String equality operator, which calculates the result of input string equality support: `**,^,*,/,+,-,%`
func NewCalc ¶
NewCalc String Equation Calculation support `f8,exp` to set .Accuracy
Example ¶
cl := NewCalc("3!+2pi") cl.Count() fmt.Printf("%v\n", cl.String()) // 等式中指定精度 cl = NewCalc("f17, 3!+2pi") cl.Count() fmt.Printf("%v\n", cl.String()) cl.Count("3-(2^2-pi)") fmt.Printf("%v\n", cl.String())
Output: 12.2831854 12.28318530717958623 2.14159265358979312
Click to show internal directories.
Click to hide internal directories.