question: private Object js_parseFloat ( Object [ ] args ) { if ( args . length < 1 ) return ScriptRuntime . NaNobj ; String s = ScriptRuntime . toString ( args [ 0 ] ) ; int len = s . length ( ) ; int start = 0 ; char c ; for ( ; ; ) { if ( start == len ) { return ScriptRuntime . NaNobj ; } c = s . charAt ( start ) ; if ( ! ScriptRuntime . isStrWhiteSpaceChar ( c ) ) { break ; } ++ start ; } int i = start ; if ( c == '+' || c == '-' ) { ++ i ; if ( i == len ) { return ScriptRuntime . NaNobj ; } c = s . charAt ( i ) ; } if ( c == 'I' ) { if ( i + 8 <= len && s . regionMatches ( i , "Infinity" , 0 , 8 ) ) { double d ; if ( s . charAt ( start ) == '-' ) { d = Double . NEGATIVE_INFINITY ; } else { d = Double . POSITIVE_INFINITY ; } return ScriptRuntime . wrapNumber ( d ) ; } return ScriptRuntime . NaNobj ; } int decimal = - 1 ; int exponent = - 1 ; boolean exponentValid = false ; for ( ; i < len ; i ++ ) { switch ( s . charAt ( i ) ) { case '.' : if ( decimal != - 1 ) break ; decimal = i ; continue ; case 'e' : case 'E' : if ( exponent != - 1 ) { break ; } else if ( i == len - 1 ) { break ; } exponent = i ; continue ; case '+' : case '-' : if ( exponent != i - 1 ) { break ; } else if ( i == len - 1 ) { -- i ; break ; } continue ; case '0' : case '1' : case '2' : case '3' : case '4' : case '5' : case '6' : case '7' : case '8' : case '9' : if ( exponent != - 1 ) { exponentValid = true ; } continue ; default : break ; } break ; } if ( exponent != - 1 && ! exponentValid ) { i = exponent ; } s = s . substring ( start , i ) ; try { return Double . valueOf ( s ) ; } catch ( NumberFormatException ex ) { return ScriptRuntime . NaNobj ; } }
target:  The global method parseFloat, as per ECMA-262 15.1.2.3.