12.07.2015 Views

Programmer's Guide & Language Reference - Dyalog Limited

Programmer's Guide & Language Reference - Dyalog Limited

Programmer's Guide & Language Reference - Dyalog Limited

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

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

Chapter 1: Introduction 30Data in component files will be stored without conversion, and only converted whena computation happens. It should be stored in decimal form if it will repeatedly beused by application code in which ⎕FRhas the value 1287. Even in applicationswhich use decimal floating point everywhere, reading old component files containingarrays of type 645, or receiving data via ⎕NA, the .Net interface or other externalsources, will allow binary floating-point values to enter the system and requireconversion.⎕DCT - Decimal Comparison ToleranceWhen ⎕FRhas the value 1287, the system variable ⎕DCT will be used to specify comparisontolerance. The default value of ⎕DCT is 1E¯28, and the maximum value is2.3283064365386962890625E¯10 (the value is chosen to avoid fuzzy comparisonof 32-bit integers).Passing floating-point values using ⎕NA⎕NA supports the data type “D” to represent the Densely Packed Decimal (DPD) formof 128-bit decimal numbers, as specified by the IEEE-754 2008 standard. <strong>Dyalog</strong> hasdecided to use DPD, which is the format used by IBM for hardware support, on ALLplatforms, although “Binary Integer Decimal” (BID) is the format that Intel librariesuse to implement software libraries to do decimal arithmetic. Experiments haveshown that the performance of 128-bit DPD and BID libraries are very similar onIntel platforms. In order to avoid the added complication of having two internal representations,<strong>Dyalog</strong> has elected to go with the hardware format, which is expectedto be adopted by future hardware implementations.The support libraries for writing AP’s and DLL’s include new functions to extract thecontents of a value of type D as a string or double-precision binary “float” – and convertdata to D format.Decimal Floats and Microsoft.NETThe Microsoft.NET framework contains a type named System.Decimal, which implementsdecimal floating-point numbers. However, it uses a different internal formatfrom that defined by IEEE-754 2008.<strong>Dyalog</strong> APL includes a Microsoft.NET class (called <strong>Dyalog</strong>.Dec128), which will performarithmetic on data represented using the “Binary Integer Decimal” format. Allcomputations performed by the <strong>Dyalog</strong>.Dec128 class will produce exactly the sameresults as if the computation was performed in APL. A “DCT” property allows settingthe comparison tolerance to be used in comparisons, Ceiling/Floor, etc).

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

Saved successfully!

Ooh no, something went wrong!