Array model: Difference between revisions

Jump to navigation Jump to search
1,123 bytes added ,  09:16, 18 October 2019
Miraheze>Marshall
No edit summary
Miraheze>Marshall
Line 61: Line 61:


An array's prototype is used to determine the value of [[Fill element|fills]] when they are required by the language.
An array's prototype is used to determine the value of [[Fill element|fills]] when they are required by the language.
=== Numeric type coercion ===
Most APLs, flat or nested, implicitly store simple numeric arrays as one of many [[Numeric type|numeric types]]. When a numeric array is formed from numbers with different types, all numbers are converted to a common type in order to be represented as a flat array. If the hierarchy of numeric types is not strict, that is, there are some pairs of numeric types for which neither type is a subset of the other, then this coercion may affect the behavior of the numbers in the array. For example, [[J]] on a 64-bit machine uses both 64-bit integers and [https://en.wikipedia.org/wiki/IEEE_754 double-precision floats]. [[Catenate|Catenating]] the two results in an array of doubles, which will lose precision for integers whose absolute value is larger than 2<sup>53</sup>. In [[Dyalog APL]] a similar issue occurs with [[decimal floats]] and [[complex numbers]]: combining the two results in an array of complex numbers, but this loses precision since Dyalog's complex numbers are stored as pairs of double-precision floats and its 128-bit decimal floats have higher precision that doubles.


== Array characteristics ==
== Array characteristics ==
Anonymous user

Navigation menu