11.07.2015 Views

Caché ObjectScript Reference - InterSystems Documentation

Caché ObjectScript Reference - InterSystems Documentation

Caché ObjectScript Reference - InterSystems Documentation

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Caché</strong> <strong>ObjectScript</strong> Functions$NORMALIZEValidates and returns a numeric value; rounds to a specified precision.$NORMALIZE(num,scale)ParametersnumscaleThe numeric value to be validated. It can be a numeric or string value, avariable name, or any valid <strong>Caché</strong> <strong>ObjectScript</strong> expression.The number of significant digits to round num to as the returned value. Thisnumber can be larger or smaller than the actual number of decimal digits innum.DescriptionThe $NORMALIZE function validates num and returns the normalized form of num. Itperforms rounding (or truncation) of decimal digits using the scale parameter. You can usethe scale parameter to round a decimal number to a specified number of decimal digits, toround a decimal number to an integer, or to truncate a decimal number to an integer.ParametersnumThe number to be validated may be an integer, a decimal number, an exponential number(with the letter “E” or “e”). It may be a string, expression, or variable that resolves to anumber. It may be signed or unsigned, and may contain leading or trailing zeros.$NORMALIZE validates character-by-character. It stops validation and returns the validatedportion of the string if:• num contains any characters other than the digits 0–9, + or – signs, a decimal point (.),and the letter “E” or “e” indicating an exponent.• num contains more than decimal point, or letter “E” or “e”.• If a + or – sign is found after a numeric in num it is considered a trailing sign, and nofurther numerics are parsed.• The letter “E” or “e” indicating an exponent is not followed by an integer.268 <strong>Caché</strong> <strong>ObjectScript</strong> <strong>Reference</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!