13.07.2015 Views

Caché Upgrade Checklists - InterSystems Documentation

Caché Upgrade Checklists - InterSystems Documentation

Caché Upgrade Checklists - InterSystems Documentation

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Caché</strong> 2008.2 <strong>Upgrade</strong> ChecklistWhenever a numeric literal is larger than 9223372036854775807E127 (or smaller than -9223372036854775808E127), a error will be generated. The error will also be generated whenever an arithmetic calculation involvingdecimal numbers exceeds this range. This reverts to the <strong>Caché</strong> behavior before version 5.2.In version 5.2, IEEE double precision numbers were introduced. In that release, IEEE double precision numbers weregenerated by the $DOUBLE function and by decimal operations that exceeded the range for these numbers. Starting withversion 2008.2, only the $DOUBLE function can be used to initially create IEEE double precision values. Out-of-rangedecimal literals and decimal calculations will generate the error. Some undefined computationsinvolving decimal functions (example: $ZLOG(0)) will now return the error rather than returningthe IEEE infinity or NaN value.Any operation with operands that are a mix of decimal numbers and IEEE double precision numbers will continue to havean IEEE double precision result. The newly defined $DECIMAL function will be available to convert IEEE double precisionnumbers to decimal numbers.The reasoning behind this change is this. The mixing of decimal floating point with binary floating point caused someproblems since their introduction. The <strong>Caché</strong> decimal type has almost 19 digits of accuracy; the IEEE binary floating-pointtype has less than 16 digits of accuracy. The IEEE binary double precison floating-point type has a much greater range(about 1.7976931348623158E308) than the Cache' decimal type (9223372036854775807E127 or9.223372036854775807E145). Thus, a conversion in either direction will lose either range or precision. Also, most decimalfractions do not have an exact representation in binary floating point. Therefore, most conversions of fractional decimalnumbers to IEEE binary floating-point numbers will involve a small change in value.To reduce the impact of these incompatibilities between decimal floating-point values and binary floating-point values,<strong>InterSystems</strong> has decided to not automatically convert between these values. A conversion directly between these numericvalues will require a direct call on the $DOUBLE or $DECIMAL functions.7.2.4.2 New $ISVALIDDOUBLE Function AddedThis version of <strong>Caché</strong> adds new function calls $ISVALIDDOUBLE(num) and $ISVALIDDOUBLE(num,scale,min,max).These functions are identical to $ISVALIDNUM except they always test validity for the $DOUBLE type.The value of min, and max are always converted to the IEEE 64-bit binary floating-point type. If the num argument has avalid format, it is convert to the IEEE 64-bit binary, floating-point type. The min/max range is tested using binary floatingpoint comparisons. If min is not supplied then $DOUBLE("-INF") is used. If max is not supplied then $DOUBLE("INF")is used. The value $DOUBLE("NAN") is always considered valid regardless of the values of min/max.7.2.4.3 New $DECIMAL Function AddedThis version of <strong>Caché</strong> implements $DECIMAL(X, N) which converts the IEEE double-precision value X to a decimalstring with N significant digits. Rounding is done according to the IEEE Floating Point standard. Currently, values of Nlarger than 40 are unsupported.If N has the value 0, then the result is a string with 20 significant digits and with special rounding. The result of$DECIMAL(X, 0) is also the default conversion of the IEEE double-precision value X to a string.When $decimal(X,0) is evaluated the following rounding is done:• No rounding is needed if the result can be represented exactly in 20 or fewer significant digits.• If the result has more than 20 significant digits, and if the 20th decimal digit is a 0 or a 5, then it is rounded up to a 1or a 6. All other digits in the 20th position will be left unchanged. Digits beyond the 20th position will be discardedor replaced with zeros as is necessary to put the string into numeric canonical form.174 <strong>Caché</strong> <strong>Upgrade</strong> <strong>Checklists</strong>

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

Saved successfully!

Ooh no, something went wrong!