<< DD: 16 bytes decimal arithmetics | DD: 16 bytes decimal arithmetics | exp >>

DD_QD (MuPAT) >> DD_QD (MuPAT) > DD: 16 bytes decimal arithmetics > dd

# dd

builds an array of DD numbers

### Syntax

    a = dd(ahi)
    a = dd(ahi,alo)

### Parameters

ahi,alo

  arrays of decimal numbers, of same sizes

a

  array of DD numbers, of size(ahi)

### Description

  Generate DD number using double precision numbers. The author applied overloading to basic arithmetic operations and several Scilab functions.

### Examples

    // define dd variables
    a = dd(1)
    b = dd(2,2^-70)
    c = 3
    d = dd(c)
    A = [1,2;3,4]
    B = dd(A)
    // ---------------------------------------------
    // four basic arithmetic for dd
    a + b
    b + 1
    2 + b
    C = ddrand(2,2) // random matrix generator
    A + C
    -b
    a - b
    b - 4
    c - b
    C - A
    b * d // scalar * scalar
    2 * b
    3 * A // scalar * matrix
    A * C // matrix * matrix
    a / b
    a / 3
    5 / b
    A / 3
    // ---------------------------------------------
    // relational operators for dd
    a == b
    a ~= b
    a <> b
    a > b
    a < b
    a >= b
    a <= b
    a == 1
    b ~= 2
    a <> 1
    b < 2
    b <= 3
    b > 3
    b >= -1
    5 < b
    2.2 <= b
    2.1 > b
    2 >= b

    // ---------------------------------------------
    // available functions for dd

    // square root
    a = dd(2)
    b = sqrt(a)

    //n-th root
    b = ddnrt(a,3)

    //absolute value
    c = -b
    abs(c)

    // cealing,floor
    d = b*10
    ceil(d)
    floor(d)

    //sin,cos,tan
    sin(d)
    cos(d)
    tan(d)

    // matrix functions
    A = ddrand(3,3)
    A(2,1) //extraction
    v = A(:,2)
    A(2,1) = dd(5) // insertion
    A(3,:) = ddrand(1,3)

    norm(v,2)

    B = ddrand(3,3)
    [L,U] = lu(B)
    [Q,R] = qr(B)

### See Also

- qd — builds an array of QD numbers

### Authors

Copyright (C) 2011 - Tsubasa Saito

Report an issue
<< DD: 16 bytes decimal arithmetics | DD: 16 bytes decimal arithmetics | exp >>