/*
FloatingPoint
For Decimal and Floating Point Literals
507749
final public void FloatingPoint() throws ParseException {
                                       /*@bgen(jjtree) FloatingPoint */
                                        AstFloatingPoint jjtn000 = new AstFloatingPoint(JJTFLOATINGPOINT);
                                        boolean jjtc000 = true;
                                        jjtree.openNodeScope(jjtn000);Token t = null;
    try {
      t = jj_consume_token(FLOATING_POINT_LITERAL);
                                 jjtree.closeNodeScope(jjtn000, true);
                                 jjtc000 = false;
                                 jjtn000.setImage(t.image);
    } finally {
      if (jjtc000) {
        jjtree.closeNodeScope(jjtn000, true);
      }
    }
  }
186187
public final void literal() throws RecognitionException {
		int literal_StartIndex = input.index();

		try {
			if ( state.backtracking>0 && alreadyParsedRule(input, 61) ) { return; }

			// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:587:5: ( integerLiteral | FloatingPointLiteral | CharacterLiteral | StringLiteral | booleanLiteral | 'null' )
			int alt84=6;
			switch ( input.LA(1) ) {
			case DecimalLiteral:
			case HexLiteral:
			case OctalLiteral:
				{
				alt84=1;
				}
				break;
			case FloatingPointLiteral:
				{
				alt84=2;
				}
				break;
			case CharacterLiteral:
				{
				alt84=3;
				}
				break;
			case StringLiteral:
				{
				alt84=4;
				}
				break;
			case 82:
			case 115:
				{
				alt84=5;
				}
				break;
			case 98:
				{
				alt84=6;
				}
				break;
			default:
				if (state.backtracking>0) {state.failed=true; return;}
				NoViableAltException nvae =
					new NoViableAltException("", 84, 0, input);
				throw nvae;
			}
			switch (alt84) {
				case 1 :
					// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:587:9: integerLiteral
					{
					pushFollow(FOLLOW_integerLiteral_in_literal2150);
					integerLiteral();
					state._fsp--;
					if (state.failed) return;
					}
					break;
				case 2 :
					// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:588:9: FloatingPointLiteral
					{
					match(input,FloatingPointLiteral,FOLLOW_FloatingPointLiteral_in_literal2160); if (state.failed) return;
					}
					break;
				case 3 :
					// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:589:9: CharacterLiteral
					{
					match(input,CharacterLiteral,FOLLOW_CharacterLiteral_in_literal2170); if (state.failed) return;
					}
					break;
				case 4 :
					// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:590:9: StringLiteral
					{
					match(input,StringLiteral,FOLLOW_StringLiteral_in_literal2180); if (state.failed) return;
					}
					break;
				case 5 :
					// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:591:9: booleanLiteral
					{
					pushFollow(FOLLOW_booleanLiteral_in_literal2190);
					booleanLiteral();
					state._fsp--;
					if (state.failed) return;
					}
					break;
				case 6 :
					// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:592:9: 'null'
					{
					match(input,98,FOLLOW_98_in_literal2200); if (state.failed) return;
					}
					break;

			}
		}
		catch (RecognitionException re) {
			reportError(re);
			recover(input,re);
		}
		finally {
			// do for sure before leaving
			if ( state.backtracking>0 ) { memoize(input, 61, literal_StartIndex); }

		}
	}
1198173
function(value) {

			value = value.toString().replace(/\s*/, '');

			// looks silly but works as expected
			// checks if value is in decimal format
			if (!isNaN(parseFloat(value)) && parseFloat(value).toString() == value) {    
				return parseFloat(value);
			// checks if it's sexagesimal format (HHH° MM' SS" (NESW))
			} else if(geolib.isSexagesimal(value) == true) {
				return parseFloat(geolib.sexagesimal2decimal(value));
			} else {
				throw 'Unknown format.';
			}

		}
196257
public static void encode(float value, byte[] dst, int dstOffset) {
        int bits = Float.floatToIntBits(value);
        bits ^= (bits < 0) ? 0xffffffff : 0x80000000;
        dst[dstOffset    ] = (byte)(bits >> 24);
        dst[dstOffset + 1] = (byte)(bits >> 16);
        dst[dstOffset + 2] = (byte)(bits >> 8);
        dst[dstOffset + 3] = (byte)bits;
    }
435942
function( str ) {
        // if whole numbers, convert to integer
        if( /^\d+$/.test(str) ) return parseInt( str );
        // if decimal, convert to float
        if( /^\d*\.\d+$/.test(str) ) return parseFloat( str );
        // if "true" or "false", return boolean
        if( /^true$/.test(str) ) return true;
        if( /^false$/.test(str) ) return false;
        // else, return original string
        return str;
    }
737058
function(decimal, units, precision) {
		if(typeof decimal !== "number" || isNaN(decimal) || !isFinite(decimal))
			return false;
		if(["inches", "feet"].indexOf(units) < 0)
			return false;
		if(["1/2", "1/4", "1/8", "1/16", "1/32", "1/64", "1/128", "1/256"].indexOf(precision) < 0)
			return false;
		
		var architectural = "";
		
		var precision = parseFloat(precision.replace("1/", ""));
		
		if(units !== "inches")
			decimal = decimal * 12;
		
		if(decimal < 0) {
			decimal = Math.abs(decimal);
			architectural += "-";
		}
		
		var feet = Math.floor(decimal / 12);
		architectural += feet + "' ";
		
		var inches = Math.floor(decimal - (feet * 12));
		architectural += inches + "\"";
		
		var fraction = Math.floor((decimal - (feet * 12) - inches) * precision);
		if(fraction > 0)
			architectural = architectural.replace("\"", " " + reduceFraction(fraction, precision) + "\"");
		
		return architectural;
	}
515509
function getDecimal(value) {
    if (!value) {
        return 0;
    }

    var num = value;
    if (!_.isNumber(value)) {
        var isNeg = ('-' && _.includes(value, '-'));

        var regExp = '[^0-9.]';
        var numString = value.toString().replace(new RegExp(regExp, 'g'), '');

        var numList = numString.split('.');

        // numList will always have at least one value in array because we checked for an empty string earlier.
        numList[0] += '.';
        numString = numList.join('');
        num = parseFloat(numString);

        if (!num) {
            num = 0;
        } else if (isNeg) {
            num *= -1;
        }
    }

    return num;
}
491694
public final void mFloatingPointLiteral() throws RecognitionException {
		try {
			int _type = FloatingPointLiteral;
			int _channel = DEFAULT_TOKEN_CHANNEL;
			// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1315:5: ( Digits '.' ( Digits )? ( Exponent )? ( FloatTypeSuffix )? | '.' Digits ( Exponent )? ( FloatTypeSuffix )? | Digits Exponent ( FloatTypeSuffix )? | Digits ( Exponent )? FloatTypeSuffix )
			int alt16=4;
			alt16 = dfa16.predict(input);
			switch (alt16) {
				case 1 :
					// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1315:9: Digits '.' ( Digits )? ( Exponent )? ( FloatTypeSuffix )?
					{
					mDigits(); 

					match('.'); 
					// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1315:20: ( Digits )?
					int alt9=2;
					int LA9_0 = input.LA(1);
					if ( ((LA9_0 >= '0' && LA9_0 <= '9')) ) {
						alt9=1;
					}
					switch (alt9) {
						case 1 :
							// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1315:20: Digits
							{
							mDigits(); 

							}
							break;

					}

					// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1315:28: ( Exponent )?
					int alt10=2;
					int LA10_0 = input.LA(1);
					if ( (LA10_0=='E'||LA10_0=='e') ) {
						alt10=1;
					}
					switch (alt10) {
						case 1 :
							// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1315:28: Exponent
							{
							mExponent(); 

							}
							break;

					}

					// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1315:38: ( FloatTypeSuffix )?
					int alt11=2;
					int LA11_0 = input.LA(1);
					if ( (LA11_0=='D'||LA11_0=='F'||LA11_0=='d'||LA11_0=='f') ) {
						alt11=1;
					}
					switch (alt11) {
						case 1 :
							// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:
							{
							if ( input.LA(1)=='D'||input.LA(1)=='F'||input.LA(1)=='d'||input.LA(1)=='f' ) {
								input.consume();
							}
							else {
								MismatchedSetException mse = new MismatchedSetException(null,input);
								recover(mse);
								throw mse;
							}
							}
							break;

					}

					}
					break;
				case 2 :
					// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1316:9: '.' Digits ( Exponent )? ( FloatTypeSuffix )?
					{
					match('.'); 
					mDigits(); 

					// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1316:20: ( Exponent )?
					int alt12=2;
					int LA12_0 = input.LA(1);
					if ( (LA12_0=='E'||LA12_0=='e') ) {
						alt12=1;
					}
					switch (alt12) {
						case 1 :
							// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1316:20: Exponent
							{
							mExponent(); 

							}
							break;

					}

					// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1316:30: ( FloatTypeSuffix )?
					int alt13=2;
					int LA13_0 = input.LA(1);
					if ( (LA13_0=='D'||LA13_0=='F'||LA13_0=='d'||LA13_0=='f') ) {
						alt13=1;
					}
					switch (alt13) {
						case 1 :
							// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:
							{
							if ( input.LA(1)=='D'||input.LA(1)=='F'||input.LA(1)=='d'||input.LA(1)=='f' ) {
								input.consume();
							}
							else {
								MismatchedSetException mse = new MismatchedSetException(null,input);
								recover(mse);
								throw mse;
							}
							}
							break;

					}

					}
					break;
				case 3 :
					// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1317:9: Digits Exponent ( FloatTypeSuffix )?
					{
					mDigits(); 

					mExponent(); 

					// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1317:25: ( FloatTypeSuffix )?
					int alt14=2;
					int LA14_0 = input.LA(1);
					if ( (LA14_0=='D'||LA14_0=='F'||LA14_0=='d'||LA14_0=='f') ) {
						alt14=1;
					}
					switch (alt14) {
						case 1 :
							// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:
							{
							if ( input.LA(1)=='D'||input.LA(1)=='F'||input.LA(1)=='d'||input.LA(1)=='f' ) {
								input.consume();
							}
							else {
								MismatchedSetException mse = new MismatchedSetException(null,input);
								recover(mse);
								throw mse;
							}
							}
							break;

					}

					}
					break;
				case 4 :
					// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1318:9: Digits ( Exponent )? FloatTypeSuffix
					{
					mDigits(); 

					// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1318:16: ( Exponent )?
					int alt15=2;
					int LA15_0 = input.LA(1);
					if ( (LA15_0=='E'||LA15_0=='e') ) {
						alt15=1;
					}
					switch (alt15) {
						case 1 :
							// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1318:16: Exponent
							{
							mExponent(); 

							}
							break;

					}

					mFloatTypeSuffix(); 

					}
					break;

			}
			state.type = _type;
			state.channel = _channel;
		}
		finally {
			// do for sure before leaving
		}
	}
882677
def decimal_default(obj):
    """"""
    if isinstance(obj, decimal.Decimal):
        if obj % 1:
            return float(obj)
        return int(obj)
    raise TypeError
1226244
def float_format(self, value):
        """"""
        if isinstance(value, str):
            # Duck-test the format string; raise ValueError on fail
            '{0:{1}}'.format(1.23, value)

            self._float_format = value
        else:
            raise TypeError('Floating point format code must be a string.')
546227
function format (value) {
  const math = getMath()

  return math.format(value, {
    fn: function (value) {
      if (typeof value === 'number') {
        // round numbers
        return math.format(value, PRECISION)
      } else {
        return math.format(value)
      }
    }
  })
}
98744
function parseViewValue(value) {
                if (angular.isUndefined(value)) {
                    value = '';
                }
                value = (""+value).replace(decimalSeparator, '.');

                // Handle leading decimal point, like ".5"
                if (value.indexOf('.') === 0) {
                    value = '0' + value;
                }

                // Allow "-" inputs only when min < 0
                if (value.indexOf('-') === 0) {
                    if (min >= 0) {
                        value = null;
                        ngModelCtrl.$setViewValue(formatViewValue(lastValidValue));
                        ngModelCtrl.$render();
                    }
                    else if (value === '-') {
                        value = '';
                    }
                }

                var empty = ngModelCtrl.$isEmpty(value);
                if (empty) {
                    lastValidValue = '';
                    //ngModelCtrl.$modelValue = undefined;
                } 
                else {
                    if (regex.test(value) && (value.length <= maxInputLength)) {
                        if ((value > max) && limitMax) {
                            lastValidValue = max;
                        }
                        else if ((value < min) && limitMin) {
                            lastValidValue = min;
                        }
                        else {
                            lastValidValue = (value === '') ? null : parseFloat(value);
                        }
                    }
                    else {
                        // Render the last valid input in the field
                        ngModelCtrl.$setViewValue(formatViewValue(lastValidValue));
                        ngModelCtrl.$render();
                    }
                }

                return lastValidValue;
            }
911291
static Selector parseFloatingLiteral(String val) {
    // Determine if this is a float constant by checking the suffix
    Number value; // was NumericValue
    char tag = val.charAt(val.length()-1);
    if (tag == 'f' || tag == 'F')
      value = new Float(val);
    else
      value = new Double(val);
    return new LiteralImpl(value);
  }
1231773
function(value, precision, base){
    var sizes =         ['Y','Z','E','P','T','G','M','k',''],
        fractionSizes = ['y','z','a','f','p','n','µ','m',''],
        total = sizes.length;

    base = base || 1000;
    precision = Math.pow(10, precision || 2);

    if (value === 0) return 0;

    if (value > 1) {
      while (total-- && (value >= base)) value /= base;
    }
    else {
      sizes = fractionSizes;
      total = sizes.length;
      while (total-- && (value < 1)) value *= base;
    }

    return (Math.round(value * precision) / precision) + sizes[total];
  }
1092312
function parse(x, n) {
  var e, i, nl;

  // Minus zero?
  if (n === 0 && 1 / n < 0) n = '-0';
  else if (!NUMERIC.test(n += '')) throw Error(INVALID + 'number');

  // Determine sign.
  x.s = n.charAt(0) == '-' ? (n = n.slice(1), -1) : 1;

  // Decimal point?
  if ((e = n.indexOf('.')) > -1) n = n.replace('.', '');

  // Exponential form?
  if ((i = n.search(/e/i)) > 0) {

    // Determine exponent.
    if (e < 0) e = i;
    e += +n.slice(i + 1);
    n = n.substring(0, i);
  } else if (e < 0) {

    // Integer.
    e = n.length;
  }

  nl = n.length;

  // Determine leading zeros before decimal point.
  for (i = 0; i < e && i < nl && n.charAt(i) == '0';) ++i;

  // older version (ignores decimal point).
  // // Determine leading zeros.
  // for (i = 0; i < nl && n.charAt(i) == '0';) ++i;

  if (i == nl) {

    // Zero.
    x.c = [x.e = 0];
  } else {

    x.e = e - i - 1;
    x.c = [];

    // Convert string to array of digits without leading zeros
    for (e = 0; i < nl;) x.c[e++] = +n.charAt(i++);

    // older version (doesn't keep trailing zeroes).
    // // Determine trailing zeros.
    // for (; nl > 0 && n.charAt(--nl) == '0';);
    // // Convert string to array of digits without leading/trailing zeros.
    // for (e = 0; i <= nl;) x.c[e++] = +n.charAt(i++);
  }

  x = round(x, Big.DP, Big.RM);
  return x;
}
300640
function (ints) {
    var ret = '0x'
    for (var i = 0; i < ints.length; i++) {
      var h = ints[i]
      if (h) {
        ret += (h <= 0xf ? '0' : '') + h.toString(16)
      } else {
        ret += '00'
      }
    }
    return ret
  }
714229
function scanNumericLiteral() {
        var number, start, ch;

        ch = source[index];
        assert(isDecimalDigit(ch.charCodeAt(0)) || (ch === '.'),
            'Numeric literal must start with a decimal digit or a decimal point');

        start = index;
        number = '';
        if (ch !== '.') {
            number = source[index++];
            ch = source[index];

            // Hex number starts with '0x'.
            // Octal number starts with '0'.
            if (number === '0') {
                // decimal number starts with '0' such as '09' is illegal.
                if (ch && isDecimalDigit(ch.charCodeAt(0))) {
                    throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
                }
            }

            while (isDecimalDigit(source.charCodeAt(index))) {
                number += source[index++];
            }
            ch = source[index];
        }

        if (ch === '.') {
            number += source[index++];
            while (isDecimalDigit(source.charCodeAt(index))) {
                number += source[index++];
            }
            ch = source[index];
        }

        if (ch === 'e' || ch === 'E') {
            number += source[index++];

            ch = source[index];
            if (ch === '+' || ch === '-') {
                number += source[index++];
            }
            if (isDecimalDigit(source.charCodeAt(index))) {
                while (isDecimalDigit(source.charCodeAt(index))) {
                    number += source[index++];
                }
            } else {
                throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
            }
        }

        if (isIdentifierStart(source.charCodeAt(index))) {
            throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
        }

        return {
            type: Token.NumericLiteral,
            value: parseFloat(number),
            range: [start, index]
        };
    }