## Julia – 4 – numeri interi e floating-point – 1

Continuo da qui, copio qui.

Integers and floating-point values are the basic building blocks of arithmetic and computation. Built-in representations of such values are called numeric primitives, while representations of integers and floating-point numbers as immediate values in code are known as numeric literals. For example, 1 is an integer literal, while 1.0 is a floating-point literal; their binary in-memory representations as objects are numeric primitives.

Julia provides a broad range of primitive numeric types, and a full complement of arithmetic and bitwise operators as well as standard mathematical functions are defined over them. These map directly onto numeric types and operations that are natively supported on modern computers, thus allowing Julia to take full advantage of computational resources. Additionally, Julia provides software support for Arbitrary Precision Arithmetic [prossimamente], which can handle operations on numeric values that cannot be represented effectively in native hardware representations, but at the cost of relatively slower performance.

The following are Julia’s primitive numeric types:

interi

``````Type    Signed? N of bits Smallest value Largest value
Int8    s       8        -2^7           2^7 - 1
UInt8           8        0              2^8 - 1
Int16   s      16        -2^15          2^15 - 1
UInt16         16        0              2^16 - 1
Int32   s      32        -2^31          2^31 - 1
UInt32         32        0              2^32 - 1
Int64   s      64        -2^63          2^63 - 1
UInt64         64        0              2^64 - 1
Int128  s     128        -2^127         2^127 - 1
UInt128       128        0              2^128 - 1
Bool    N/A     8        false (0)      true (1)``````

floating-point

``````Type    Precision  N of bits
Float16 half       16
Float32 single     32
Float64 double     64``````

Additionally, full support for Complex and Rational Numbers [prossimamente] is built on top of these primitive numeric types. All numeric types interoperate naturally without explicit casting, thanks to a flexible, user-extensible type promotion system [prossimamente].

Niente di nuovo, anzi Julia è proprio come uno se l’aspetta. Ma va affrontata un po’ per volta, pausa 😊

Annunci
Posta un commento o usa questo indirizzo per il trackback.