bigfloat

package module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2026 License: MIT Imports: 2 Imported by: 36 modules, 40 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Package bigfloat provides arbitrary-precision natural logarithm (Log), and exponentiation (Exp, and Pow) functions for the standard library's big.Float type.

GoDoc

Example

package main

import (
	"fmt"
	"math/big"

	"github.com/ALTree/bigfloat"
)

// We'll compute the value of the transcendental number 2^√2, also
// known as the Gelfond–Schneider constant, to 1000 bits.
func main() {
	const prec = 1000 // in binary digits
	two := big.NewFloat(2).SetPrec(prec)
	sqrtTwo := new(big.Float).SetPrec(prec).Sqrt(two)

	// Pow uses the first argument's precision.
	gsc := bigfloat.Pow(two, sqrtTwo) // 2^√2
	fmt.Printf("gsc = %.60f\n", gsc)
}

outputs:

gsc = 2.665144142690225188650297249873139848274211313714659492835980

Documentation

See https://godoc.org/github.com/ALTree/bigfloat

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Exp

func Exp(z *big.Float) *big.Float

Exp returns a big.Float representation of eᶻ, aka exp(z). Precision is the same as the one of the argument. Returns +Inf when z = +Inf, and 0 when z = -Inf.

func Log

func Log(z *big.Float) *big.Float

Log returns a big.Float representation of ln(z), aka the natural logarithm of z. Precision is the same as the one of the argument. The function panics if z is negative, returns -Inf when z = 0, and +Inf when z = +Inf

func Pow

func Pow(z *big.Float, w *big.Float) *big.Float

Pow returns a big.Float representation of zʷ. Precision is the same as the one of the first argument. The function panics when z is negative and w is not an integer.

Types

This section is empty.

Jump to

Keyboard shortcuts

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