math

package
v2.4.1 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compute

func Compute(a, b any, op rune) (float64, error)
Example
package main

import (
	"fmt"
	"github.com/CarsonSlovoka/go-pkg/v2/math"
)

func main() {
	fmt.Println(math.Compute(3, 2, '+'))
	fmt.Println(math.Compute("3.4", 5, '+'))
	fmt.Println(math.Compute("3.4", "-5", '-'))
	fmt.Println(math.Compute("-10", "5", '-'))
	fmt.Println(math.Compute("3.4", "4", '*'))
	fmt.Println(math.Compute("3", "1.5", '/'))

}
Output:

5 <nil>
8.4 <nil>
8.4 <nil>
-15 <nil>
13.6 <nil>
2 <nil>

Types

This section is empty.

Jump to

Keyboard shortcuts

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