ftoa

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package ftoa provides ECMAScript-compliant floating point number conversion to string.

It contains code ported from Rhino (https://github.com/mozilla/rhino/blob/master/src/org/mozilla/javascript/DToA.java) as well as from the original code by David M. Gay.

See LICENSE_LUCENE for the original copyright message and disclaimer.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FToBaseStr

func FToBaseStr(num float64, radix int) string

func FToStr

func FToStr(d float64, mode FToStrMode, precision int, buffer []byte) []byte

Types

type FToStrMode

type FToStrMode int
const (
	// Either fixed or exponential format; round-trip
	ModeStandard FToStrMode = iota
	// Always exponential format; round-trip
	ModeStandardExponential
	// Round to <precision> digits after the decimal point; exponential if number is large
	ModeFixed
	// Always exponential format; <precision> significant digits
	ModeExponential
	// Either fixed or exponential format; <precision> significant digits
	ModePrecision
)

Directories

Path Synopsis
internal
fast
Package fast contains code ported from V8 (https://github.com/v8/v8/blob/master/src/numbers/fast-dtoa.cc)
Package fast contains code ported from V8 (https://github.com/v8/v8/blob/master/src/numbers/fast-dtoa.cc)

Jump to

Keyboard shortcuts

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