# naginterfaces.library.dot.real_​prec¶

naginterfaces.library.dot.real_prec(a, b, c1, c2, sw)[source]

real_prec calculates the value of a scalar product using basic precision or additional precision and adds it to a basic precision or additional precision initial value.

For full information please refer to the NAG Library document for x03aa

https://www.nag.com/numeric/nl/nagdoc_28.5/flhtml/x03/x03aaf.html

Parameters
afloat, array-like, shape

The elements of the first vector.

bfloat, array-like, shape

The elements of the second vector.

c1float

and must specify the initial value : . Normally, if is in additional precision, specifies the most significant part and the least significant part; if is in basic precision, then specifies and must have the value . Both and must be defined on entry.

c2float

and must specify the initial value : . Normally, if is in additional precision, specifies the most significant part and the least significant part; if is in basic precision, then specifies and must have the value . Both and must be defined on entry.

swbool

The precision to be used in the calculation.

basic precision.

Returns
d1float

The result .

If the calculation is in additional precision (),

rounded to basic precision;

,

thus holds the correctly rounded basic precision result and the sum gives the result in additional precision. may have the opposite sign to .

If the calculation is in basic precision (),

;

.

d2float

The result .

If the calculation is in additional precision (),

rounded to basic precision;

,

thus holds the correctly rounded basic precision result and the sum gives the result in additional precision. may have the opposite sign to .

If the calculation is in basic precision (),

;

.

Raises
NagValueError
(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, , and .

Constraint: .

(errno )

On entry, , and .

Constraint: .

Notes

No equivalent traditional C interface for this routine exists in the NAG Library.

real_prec calculates the scalar product of two float vectors and adds it to an initial value to give a correctly rounded result :

If , .

The vector elements and are stored in selected elements of the one-dimensional array arguments and .

Both the initial value and the result are defined by a pair of float variables, so that they may take either basic precision or additional precision values.

1. If , the products are accumulated in additional precision, and on exit the result is available either in basic precision, correctly rounded, or in additional precision.

2. If , the products are accumulated in basic precision, and the result is returned in basic precision.

This function is designed primarily for use as an auxiliary function by other functions in the NAG Library, especially those in the modules on Linear Algebra.