uxarray.utils.computing._two_square

Contents

uxarray.utils.computing._two_square#

uxarray.utils.computing._two_square(Aa)#

Compute the square of a number with a compensation for the round-off error.

This function calculates the square of a given number and compensates for the round-off error that occurs during the squaring.

Parameters:

Aa (float) – The number to be squared.

Returns:

The square of the number and the compensated round-off error.

Return type:

tuple of float

Examples

>>> _two_square(2.0)
(4.0, 0.0)

Siegfried Rump. Fast and accurate computation of the Euclidean norm of a vector. J apan Journal of Industrial and Applied Mathematics, 40, 2023. 10.1007/s13160-023-00593-8