dd — generate DD variable
a = dd(ahi) a = dd(ahi,alo)
Generate DD number using double precision numbers. The author applied overloading to basic arithmetic operations and several Scilab functions.
// 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 = nrt(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] = qd(B)