APIdia Launch Partner
Top Fields Constructors Methods
com.sun.javafx.css.parser

public final Class CssNumberParser

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private static final int
private static final int
private static final long[]
T

128-bit reciprocal and normalized powers of five, stored as two 64-bit words.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private static double
convertToNearestDouble(long w, int q)

Converts a decimal floating-point number w*10^q to the nearest representable double.

private static double
normalDouble(long m, long p)

public static double
parseDouble(String s)

Parses a number according to the W3C "Consume a number" algorithm.

public static double
parseDouble(String s, int start, int end)

Parses a number according to the W3C "Consume a number" algorithm.

public static double

Returns:

the number, or NaN if the substring does not consist entirely of a valid number representation
tryParseDouble
(String s, int start, int end)

Parses a number according to the W3C "Consume a number" algorithm.

public static long
tryParseInt(String s, int start, int end, int radix)

Parses a number as an integer.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

EXP_LIMITback to summary
private static final int EXP_LIMIT
MAX_SIG_DIGITSback to summary
private static final int MAX_SIG_DIGITS
Tback to summary
private static final long[] T

128-bit reciprocal and normalized powers of five, stored as two 64-bit words. See "Table Generation Script" in "Number Parsing at a Gigabyte per Second" (Lemire, 2021), p. 32

See Also
Number Parsing at a Gigabyte per Second

Constructor Detail

CssNumberParserback to summary
private CssNumberParser()

Method Detail

convertToNearestDoubleback to summary
private static double convertToNearestDouble(long w, int q)

Converts a decimal floating-point number w*10^q to the nearest representable double.

Based on Algorithm 1, "Number Parsing at a Gigabyte per Second" (Lemire, 2021), p. 8, without the fallback condition; see "Fast Number Parsing Without Fallback" (Mushtak, Lemire, 2022).

Precondition

w != 0 and q in [-342, 308]

See Also
Number Parsing at a Gigabyte per Second, Fast Number Parsing Without Fallback
normalDoubleback to summary
private static double normalDouble(long m, long p)
parseDoubleback to summary
public static double parseDouble(String s)

Parses a number according to the W3C "Consume a number" algorithm. A number can have integer and fractional parts, and it supports E notation (exponential).

Exceptions
NumberFormatException:
if the string does not consist entirely of a valid number representation
See Also
Consume a number
parseDoubleback to summary
public static double parseDouble(String s, int start, int end)

Parses a number according to the W3C "Consume a number" algorithm. A number can have integer and fractional parts, and it supports E notation (exponential).

Exceptions
NumberFormatException:
if the substring does not consist entirely of a valid number representation
See Also
Consume a number
tryParseDoubleback to summary
public static double tryParseDouble(String s, int start, int end)

Parses a number according to the W3C "Consume a number" algorithm. A number can have integer and fractional parts, and it supports E notation (exponential).

This method operates on the substring [start, end) of s, which is expected to contain the string representation of a number without leading or trailing whitespace.

This implementation is allocation-free for significands with less than 20 digits and returns the nearest representable double value of the input string, with ties rounding to even.

Returns:double

the number, or NaN if the substring does not consist entirely of a valid number representation

See Also
Consume a number
tryParseIntback to summary
public static long tryParseInt(String s, int start, int end, int radix)

Parses a number as an integer. If successful, returns the integer as a long value; otherwise returns a long value less than Integer#MIN_VALUE to indicate failure.