Created
October 10, 2019 08:45
-
-
Save yanmhlv/4fa7dacb6de257e3011991baf1fff76b to your computer and use it in GitHub Desktop.
big.Float wrapper
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package bigfloat | |
import ( | |
"fmt" | |
"math/big" | |
) | |
func Zero() *big.Float { return big.NewFloat(0.0) } | |
func Sub(x, y *big.Float) *big.Float { return Zero().Sub(x, y) } | |
func Add(x, y *big.Float) *big.Float { return Zero().Add(x, y) } | |
func Mult(x, y *big.Float) *big.Float { return big.NewFloat(1.0).Mul(x, y) } | |
func Div(x, y *big.Float) *big.Float { return big.NewFloat(1.0).Quo(x, y) } | |
func Abs(x *big.Float) *big.Float { return Zero().Abs(x) } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment