float>json ( float -- string ) - Factor Documentation

float>json ( float -- string )


Vocabulary
json

Inputs
float an object


Outputs
string an object


Definition
USING: combinators kernel math math.parser namespaces ;

IN: json

: float>json ( float -- string )
dup fp-special? [
json-allow-fp-special? get
[ json-fp-special-error ] unless {
{ [ dup fp-nan? ] [ drop "NaN" ] }
{ [ dup 1/0. = ] [ drop "Infinity" ] }
{ [ dup -1/0. = ] [ drop "-Infinity" ] }
} cond
] [ number>string ] if ;

AltStyle によって変換されたページ (->オリジナル) /