...

Package ftoa

import "github.com/dop251/goja/ftoa"
Overview
Index
Subdirectories

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.

func FToBaseStr

func FToBaseStr(num float64, radix int) string

func FToStr

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

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
)

Subdirectories

Name Synopsis
..