11.07.2015 Views

Caché ObjectScript Reference - InterSystems Documentation

Caché ObjectScript Reference - InterSystems Documentation

Caché ObjectScript Reference - 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> <strong>ObjectScript</strong> FunctionsWRITE !,$DOUBLE(999.12345678987654321)WRITE !,$DOUBLE(.99912345678987654321)WRITE !,$DOUBLE(999123456789876543.21)The following example returns the value of pi as a $DOUBLE value and as a standard <strong>Caché</strong>decimal value. This example shows that equality operations should not be attempted between$DOUBLE and standard <strong>Caché</strong> decimal numbers, and that the number of digits returned isgreater for standard <strong>Caché</strong> decimal numbers:SET x=$ZPISET y=$DOUBLE($ZPI)IF x=y { WRITE !,"Same" }ELSE { WRITE !,"Different"WRITE !,"standard: ",xWRITE !,"IEEE float: ",y }The following examples show that a floating point number is not necessarily equivalent to anumeric string of the same value:SET x=123.4567891234560SET y=123.4567891234567IF x=$DOUBLE(x) { WRITE !,"Same" }ELSE { WRITE !,"Different" }IF y=$DOUBLE(y) { WRITE !,"Same" }ELSE { WRITE !,"Different" }SET x=1234567891234560SET y=1234567891234567IF x=$DOUBLE(x) { WRITE !,"Same" }ELSE { WRITE !,"Different" }IF y=$DOUBLE(y) { WRITE !,"Same" }ELSE { WRITE !,"Different" }See Also• ZZDUMP command• $FNUMBER function• $NUMBER function• Data Types in the <strong>Caché</strong> SQL <strong>Reference</strong>202 <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!