Top Description Fields Constructors Methods
ch.randelshofer.fastdoubleparser

pack-priv Class ParseDigitsTaskCharArray

extends Object
Class Inheritance
Imports
java.math.BigInteger, java.util.Map

Parses digits in exponential time O(e^n).

Field Summary

Modifier and TypeField and Description
pack-priv static final int
RECURSION_THRESHOLD

Threshold on the number of digits for selecting the recursive algorithm instead of the iterative algorithm.

Constructor Summary

AccessConstructor and Description
private
ParseDigitsTaskCharArray()

Don't let anyone instantiate this class.

Method Summary

Modifier and TypeMethod and Description
pack-priv static BigInteger
parseDigitsIterative(char[] str, int from, int to)

Parses digits in quadratic time O(N2).

pack-priv static BigInteger
parseDigitsRecursive(char[] str, int from, int to, Map<Integer, BigInteger> powersOfTen)

Parses digits in O(N log N (log log N)) time.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

RECURSION_THRESHOLDback to summary
pack-priv static final int RECURSION_THRESHOLD

Threshold on the number of digits for selecting the recursive algorithm instead of the iterative algorithm.

Set this to Integer#MAX_VALUE if you only want to use the iterative algorithm.

Set this to 0 if you only want to use the recursive algorithm.

Rationale for choosing a specific threshold value: The iterative algorithm has a smaller constant overhead than the recursive algorithm. We speculate that we break even somewhere at twice the threshold value.

Constructor Detail

ParseDigitsTaskCharArrayback to summary
private ParseDigitsTaskCharArray()

Don't let anyone instantiate this class.

Method Detail

parseDigitsIterativeback to summary
pack-priv static BigInteger parseDigitsIterative(char[] str, int from, int to)

Parses digits in quadratic time O(N2).

parseDigitsRecursiveback to summary
pack-priv static BigInteger parseDigitsRecursive(char[] str, int from, int to, Map<Integer, BigInteger> powersOfTen)

Parses digits in O(N log N (log log N)) time.

A conventional recursive algorithm would require O(N1.5). We achieve better performance by performing multiplications of long bit sequences in the frequencey domain.