ISO,IEC 10967-3 standard.Language independent arithmetic
.pdf
Working draft ISO/IEC WD 10967-3.1:2001(E)
The coshi(F ) operation:
coshi(F ) : i(F ) ! F [ funder ow; absolute precision under owg coshi(F )(^ y) = cosF (y)
The coshc(F ) operation:
coshc(F ) : c(F ) ! c(F ) [ funder ow; over ow; absolute precision under owg coshc(F )(x +^ y)
=cosc(F )(y +^ negF (x))
5.3.3.4Hyperbolic tangent
NOTE { tanh( z) = tanh(z) tanh(conj(z)) = conj(tanh(z))
tanh(z +~ k 2 ) = tanh(z) if k 2 Z tanh(z) = coth(~ =2 z)
tanh(x) = ~ tan(~ x) = ~ tan( ~ x) tanh(~ y) = ~ tan( y) = ~ tan(y)
tanh(x +~ y) = ~ tan( y +~ x) = ~ tan(y ~ x)
The tanhi(F ) operation:
tanhi(F ) : i(F ) ! i(F ) [ funder ow; over ow; absolute precision under owg tanhi(F )(^ y) = ^ (tanF (y))
The tanhc(F ) operation:
tanhc(F ) : c(F ) ! c(F ) [ funder ow; over ow; absolute precision under owg tanhc(F )(x +^ y)
=itimesc(F )(tanc(F )(y +^ negF (x)))
5.3.3.5Hyperbolic cotangent
NOTE { coth( z) = coth(z) coth(conj(z)) = conj(coth(z))
coth(z +~ k 2 ) = coth(z) if k 2 Z coth(z) = tanh(~ =2 z)
coth(z) = 1= tanh(z)
coth(x) = ~ cot(~ x) = ~ cot( ~ x) coth(~ y) = ~ cot( y) = ~ cot(y)
coth(x +~ y) = ~ cot( y +~ x) = ~ cot(y ~ x)
The cothi(F ) operation:
cothi(F ) : i(F ) ! i(F ) [ funder ow; over ow; in nitary; absolute precision under owg cothi(F )(^ y) = ^ (cotF (negF (y)))
The cothc(F ) operation:
cothc(F ) : c(F ) ! c(F ) [ funder ow; over ow; in nitary; absolute precision under owg
5.3.3 Operations for hyperbolic elementary functions |
43 |
ISO/IEC WD 10967-3.1:2001(E) |
Working draft |
cothc(F )(x +^ y)
=itimesc(F )(cotc(F )(negF (y) +^ x))
5.3.3.6Hyperbolic secant
NOTE { sech( z) = sech(z) sech(conj(z)) = conj(sech(z))
sech(z +~ k 2 ) = sech(z) if k 2 Z sech(z) = csch(~ =2 z)
sech(z) = 1= cosh(z)
sech(x) = sec(~ x) = sec( ~ x) sech(~ y) = sec( y) = sec(y)
sech(x +~ y) = sec( y +~ x) = sec(y ~ x)
operation:
: i(F ) ! F [ fover ow; absolute precision under owg sechi(F )(^ y) = secF (negF (y))
operation:
: c(F ) ! c(F ) [ funder ow; over ow; absolute precision under owg sechc(F )(x +^ y)
=secc(F )(negF (y) +^ x)
5.3.3.7Hyperbolic cosecant
NOTE { csch( z) = csch(z) csch(conj(z)) = conj(csch(z))
csch(z +~ k 2 ) = csch(z) if k 2 Z csch(z) = sech(~ =2 z)
csch(z) = 1= sinh(z)
csch(x) = ~ csc(~ x) = ~ csc( ~ x) csch(~ y) = ~ csc( y) = ~ csc(y)
csch(x +~ y) = ~ csc( y +~ x) = ~ csc(y ~ x)
The cschi(F ) operation:
cschi(F ) : i(F ) ! i(F ) [ fover ow; in nitary; absolute precision under owg cschi(F )(^ y) = ^ (cscF (negF (y)))
The cschc(F ) operation:
cschc(F ) : c(F ) ! c(F ) [ funder ow; over ow; in nitary; absolute precision under owg
cschc(F )(x +^ y)
= itimesc(F )(cscc(F )(negF (y) +^ x))
44 |
Speci cations for imaginary and complex datatypes and operations |
Working draft |
ISO/IEC WD 10967-3.1:2001(E) |
5.3.3.8Inverse hyperbolic sine
NOTE 1 { arcsinh( z) = arcsinh(z)
arcsinh(conj(z)) = conj(arcsinh(z)) if Re(z) 6= 0 or jIm(z)j 6 1 arcsinh(z) = ~ =2 arccosh(z) if Re(z) > 0?
Arcsinh(x +~ y) = ~ Arcsin( y +~ x) = ~ Arcsin(y ~ x)
The arcsinhi(F ) operation:
arcsinhi(F ) : i(F ) ! i(F ) [ finvalidg
arcsinhi(F )(^ y)
= ^ arcsinF (y)
The arcsinhi(F )!c(F ) operation: arcsinhi(F )!c(F ) : i(F ) ! c(F )
arcsinhi(F )!c(F )(^ y)
= arccoshF (neqF (y)) +^ upF ( =2)
if (y 2 F and y < 1) or y = 1
= mulF ( 0; y) +^ arcsinF (y)
if (y 2 F and jyj 6 1) or y = 0
= negF (arccoshF (y)) +^ downF ( =2)
if (y 2 F and y > 1) or y = +1 otherwise
The arcsinhc(F ) operation:
arcsinhc(F ) : c(F ) ! c(F ) [ funder owg
arcsinhc(F )(x +^ y)
= itimesc(F )(arcsinc(F )(y +^ negF (x)))
NOTE 2 { The inverse of sinh is multi-valued, the imaginary part may have any integer multiple of 2 added to it, and the result is also in the solution set. The arcsinh function (returning the principal value for the inverse) branch cuts at f~ y j y 2 R and jyj > 1g. Thus arcsinhc(F )(0 +^ y) 6= arcsinhc(F )( 0 +^ y) when jyj > 1.
5.3.3.9Inverse hyperbolic cosine
NOTE 1 { arccosh( z) = ~ arccosh(z) arccosh(conj(z)) = conj(arccosh(z)) if Im(z) 6= 0 or Re(z) > 1 arccosh(z) = ~ =2 arcsinh(z) if Re(z) > 0?
Arccosh(x +~ y) = ~ Arccos(x +~ y)
The arccoshF !c(F ) operation: arccoshF !c(F ) : F ! c(F [ f 0g)
arccoshF !c(F )(x)
= arccoshF (x) +^ ( 0)
if (x 2 F and x > 1) or x = +1
= 0 +^ mulF (neqF (signbF (x)); arccosF (x))
if (x 2 F and jxj < 1) or x = 0
= arccoshF (negF (x)) +^ downF ( )
if (x 2 F and x 6 1) or x = 1
= no |
|
resultF !c(F )(x) |
otherwise |
|
5.3.3 Operations for hyperbolic elementary functions |
45 |
ISO/IEC WD 10967-3.1:2001(E) Working draft
The arccoshi(F )!c(F ) operation: arccoshi(F )!c(F ) : i(F ) ! c(F )
arccoshi(F )!c(F )(^ y)
= itimesc(F )(arccosi(F )!c(F )(^ y))
if (y 2 F and y > 0) or y = +1
= negc(F )(itimesc(F )(arccosi(F )!c(F )(^ y)))
if (y 2 F and y < 0) or y 2 f1; 0g = no resulti(F )!c(F )(^ y) otherwise
The arccoshc(F ) operation: arccoshc(F ) : c(F ) ! c(F )
arccoshc(F )(x +^ y)
= itimesc(F )(arccosc(F )(x +^ y))
if (y 2 F and y > 0) or y = +1
= negc(F )(itimesc(F )(arccosc(F )(x +^ y)))
if (y 2 F and y < 0) or y 2 f1; 0g = no resultc(F )(x +^ y) otherwise
NOTE 2 { The inverse of cosh is multi-valued, the imaginary part may have any integer multiple of 2 added to it, and the result is also in the solution set. The arccosh function (returning the principal value for the inverse) branch cuts at fx j x 2 R and x < 1g. Thus arccoshc(F )(x +^ 0) 6= arccoshc(F )(x +^ ( 0)) when x < 1 or x = 0.
5.3.3.10Inverse hyperbolic tangent
NOTE 1 { arctanh( z) = arctanh(z)
arctanh(conj(z)) = conj(arctanh(z)) if Im(z) 6= 0 or jRe(z)j 6 1 arctanh(z) = ~ =2 arccoth(z)
Arctanh(x +~ y) = ~ Arctan( y +~ x) = ~ Arctan(y ~ x)
The arctanhF !c(F ) operation:
arctanhF !c(F ) : F ! c(F [ f 0g) [ funder ow; in nitaryg
arctanhF !c(F )(x)
= upF ( =2) +^ (arccothF (x))
if (x 2 F and x > 1) or x = +1
= arctanhF (x) +^ mulF ( 0; x)
if (x 2 F and jxj < 1) or x = 0
= downF ( =2) +^ (arccothF (x))
if (x 2 F and x 6 1) or x = 1
= in nitary(?up( =4) +^ :::) if ...
= no resultF !c(F )(x) otherwise
The arctanhi(F ) operation: arctanhi(F ) : i(F ) ! i(F )
arctanhi(F )(^ y)
= ^ arctanF (y) The arctanhc(F ) operation:
46 |
Speci cations for imaginary and complex datatypes and operations |
Working draft ISO/IEC WD 10967-3.1:2001(E)
arctanhc(F ) : c(F ) ! c(F ) [ funder ow; in nitaryg
arctanhc(F )(x +^ y)
= itimesc(F )(arctanc(F )(y +^ negF (x)))
NOTE 2 { The inverse of tanh is multi-valued, the imaginary part may have any integer multiple of 2 (even any integer multiple of ) added to it, and the result is also in the solution set. The arctanh function (returning the principal value for the inverse) branch cuts
at fx j x 2 R and jxj > 1g. Thus arctanhc(F )(x + ^ 0) 6= arctanhc(F )(x + ^ ( 0)) when jxj > 1.
5.3.3.11Inverse hyperbolic cotangent
NOTE 1 { arccoth( z) = arccoth(z)
arccoth(conj(z)) = conj(arccoth(z)) if Im(z) 6= 0 or jRe(z)j > 1 arccoth(z) = ~ =2 arctanh(z) if ...
Arccoth(x +~ y) = ~ Arccot( y +~ x) arccoth(z) = arctanh(1=z)
The arccothF !c(F ) operation:
arccothF !c(F ) : F ! c(F [ f 0g) [ funder ow; in nitaryg
arccothF !c(F )(x)
= arccothF (x) +^ mulF ( 0; x)
if (x 2 F and jxj > 1) or x 2 f1; +1g
= downF ( =2) +^ (arctanhF (x))
if (x 2 F and 1 6 x < 0) or x = 0
= upF ( =2) +^ (arctanhF (x))
if x 2 F and 0 6 x 6 1 = in nitary(?upF ( =4) +if^...:::)
= no resultF !c(F )(x) otherwise
The arccothi(F ) operation:
arccothi(F ) : i(F ) ! i(F ) [ funder owg
arccothi(F )(^ y)
= ^ arccotF (negF (y))
The arccothc(F ) operation:
arccothc(F ) : c(F ) ! c(F ) [ funder ow; in nitaryg
arccothc(F )(x +^ y)
= itimesc(F )(arccotc(F )(negF (y) +^ x))
NOTE 2 { The inverse of coth is multi-valued, the imaginary part may have any integer multiple of 2 (even any integer multiple of ) added to it, and the result is also in the solution set. The arccoth function (returning the principal value for the inverse) branch cuts
at fx j x 2 R and jxj < 1g. Thus arccothc(F )(x+^ 0) 6= arccothc(F )(x+^ ( 0)) when jxj < 1 or x = 0.
5.3.3 Operations for hyperbolic elementary functions |
47 |
ISO/IEC WD 10967-3.1:2001(E) |
Working draft |
5.3.3.12Inverse hyperbolic secant
NOTE 1 { arcsech( z) = ~ arcsech(z)
arcsech(conj(z)) = conj(arcsech(z)) if Im(z) 6= 0 or 0 6 Re(z) 6 1 arcsech(z) = ~ =2 arccsch(z) if Re(z) > 0?
Arcsech(x +~ y) = ~ Arcsec(x +~ y) arcsech(z) = arccosh(1=z)
The arcsechF !c(F ) operation:
arcsechF !c(F ) : F ! c(F [ f 0g) [ funder ow; in nitaryg
arcsechF !c(F )(x)
= 0 +^ arcsecF (x) if (x 2 F and x > 1) or x = +1
= arcsechF (x) +^ 0 if x 2 F and 0x < 1 = arcsechF (negF (x)) +^ upF ( )
if x 2 F and 1 < x < 0
=0 +^ arcsecF (x) if (x 2 F and x 6 1) or x = 1
=in nitary(+1 +^ (?upF ( =2)))
if x 2 f 0; 0g otherwise
The arcsechi(F )!c(F ) operation:
arcsechi(F )!c(F ) : i(F ) ! c(F ) [ funder ow; in nitaryg
arcsechi(F )!c(F )(^ y)
= itimesc(F )(arcseci(F )!c(F )(^ y))
if (y 2 F and y > 0) or y = +1
= negc(F )(itimesc(F )(arcseci(F )!c(F )(^ y)))
if (y 2 F and y < 0) or y 2 f 1; 0g
= no resulti(F )!c(F )(^ y)
otherwise
The arcsechc(F ) operation:
arcsechc(F ) : c(F ) ! c(F ) [ funder ow; in nitaryg
arcsechc(F )(x +^ y)
= itimesc(F )(arcsecc(F )(x +^ y))
if (y 2 F and y > 0) or y = +1
= negc(F )(itimesc(F )(arcsecc(F )(x +^ y)))
if (y 2 F and y < 0) or y 2 f 1; 0g
= no resultc(F )(x +^ y)
otherwise
NOTE 2 { The inverse of sech is multi-valued, the imaginary part may have any integer multiple of 2 added to it, and the result is also in the solution set. The arcsech function (returning the principal value for the inverse) branch cuts at fx j x 2 R and x 6 0 or x > 1g. Thus arcsechc(F )(x +^ 0) 6= arcsechc(F )(x +^ ( 0)) when x 6 0 or x = 0 or x > 1.
5.3.3.13Inverse hyperbolic cosecant
NOTE 1 { arccsch( z) = arccsch(z)
arccsch(conj(z)) = conj(arccsch(z)) if Re(z) 6= 0 or jIm(z)j > 1 arccsch(z) = ~ =2 arcsech(z) if Re(z) > 0?
48 |
Speci cations for imaginary and complex datatypes and operations |
Working draft ISO/IEC WD 10967-3.1:2001(E)
Arccsch(x +~ y) = ~ Arccsc( y +~ x) arccsch(z) = arcsinh(1=z)
The arccschi(F ) operation:
arccschi(F ) : i(F ) ! i(F ) [ funder ow; invalidg
arccschi(F )(^ y)
= ^ arccscF (negF (y))
The arccschF !c(F ) operation:
arccschF !c(F ) : i(F ) ! c(F ) [ funder ow; in nitaryg
arccschF !c(F )(^ y)
= ( 0) +^ negF (arccscF (y))
if (y 2 F and y > 1) or y = +1
= negF (arcsechF (y)) +^ upF ( =2)
if (y 2 F and 0 6 y 6 1) = arcsechF (y)?? +^ downF ( =2)
if (y 2 F and 1 6 y < 0) or y = 0
= 0 +^ negF (arccscF (y))
if (y 2 F and y < 1) or y = 1 = no resulti(F )!c(F )(y) otherwise
The arccschc(F ) operation:
arccschc(F ) : c(F ) ! c(F ) [ funder ow; in nitaryg
arccschc(F )(x +^ y)
= itimesc(F )(arccscc(F )(negF (y) +^ x))
NOTE 2 { The inverse of csch is multi-valued, the imaginary part may have any integer multiple of 2 added to it, and the result is also in the solution set. The arccsch function (returning the principal value for the inverse) branch cuts at f~ y j y 2 R and jyj < 1g. Thus arccschc(F )(0 +^ y) 6= arccschc(F )( 0 +^ y) when 1 < y < 1 or y = 0.
5.4Operations for conversion between numeric datatypes
5.4.1Integer to complex integer conversions
Let I and I0 be the non-special value sets for two integer datatypes, at least one of which conforms to ISO/IEC 10967-1.
convertI!c(I) : I ! c(I)
convertI!c(I)(x)
= x +^ 0
converti(I)!c(I) : i(I) ! c(I)
converti(I)!c(I)(^ y)
= 0 +^ y
converti(I)!i(I0) : i(I) ! i(I0) [ fover owg
5.4 Operations for conversion between numeric datatypes |
49 |
ISO/IEC WD 10967-3.1:2001(E) |
Working draft |
converti(I)!i(I0)(^ y)
= ^ convertI!I0(y)
convertc(I)!c(I0) : c(I) ! c(I0) [ fover owg convertc(I)!c(I0)(x +^ y)
=convertI!I0(x) +^ convertI!I0(y)
5.4.2Floating point to complex oating point conversions
Let F and F 0 be the non-special value sets for two oating point datatypes, at least one of which conforms to ISO/IEC 10967-1. Let D be the non-special value set for a xed point datatype (see clause 5.4.5 in ISO/IEC 10967-2).
The convertF !c(F ) operation: |
|
convertF !c(F ) : F ! c(F [ f 0g) |
|
convertF !c(F )(x) |
if x 2 F [ f1; 0; +1g |
= x +^ imF (x) |
|
= no resultF !c(F )(x) |
otherwise |
The converti(F )!c(F ) operation: converti(F )!c(F ) : i(F ) ! c(F [ f 0g) converti(F )!c(F )(^ y)
=rei(F )(^ y) +^ y if y 2 F [ f1; 0; +1g
=no resulti(F )!c(F )(^ y)
otherwise
The converti(F )!i(F 0) operation: converti(F )!i(F 0)
converti(F )!i(F 0)
The convertc(F )!c(F 0) operation:
convertc(F )!c(F 0) : c(F ) ! c(F 0) [ funder ow; over owg
convertc(F )!c(F 0)(x +^ y)
= convertF !F 0(x) +^ convertF !F 0(y)
The converti(F )!i(D) operation:
converti(F )!i(D) : i(F ) ! i(D) [ fover owg converti(F )!i(D)
The convertc(F )!c(D) operation:
convertc(F )!c(D) : c(F ) ! c(D) [ fover owg
50 |
Speci cations for imaginary and complex datatypes and operations |
Working draft |
ISO/IEC WD 10967-3.1:2001(E) |
convertc(F )!c(D)(x +^ y)
= convertF !D(x) +^ convertF !D(y)
The converti(D)!i(F ) operation:
converti(D)!i(F ) : i(D) ! i(F ) [ funder ow; over owg
converti(D)!i(F )(^ y)
= ^ convertD!F (y)
The convertc(D)!c(F ) operation:
convertc(D)!c(F ) : c(D) ! c(F ) [ funder ow; over owg convertc(D)!c(F )(x +^ y)
=convertD!F (x) +^ convertD!F (y)
5.5Support for imaginary and complex numerals
EDITOR'S NOTE { ...numerals; or rather imaginary units
6Noti cation
Noti cation is the process by which a user or program is informed that an arithmetic operation cannot return a suitable numeric result. Speci cally, a noti cation shall occur when any arithmetic operation returns an exceptional value. Noti cation shall be performed according to the requirements of clause 6 of part 1.
An implementation shall not give noti cations for operations conforming to this part, unless the speci cation requires that an exceptional value results for the given arguments.
The default method of noti cation should be recording of indicators.
6.1Continuation values
If noti cations are handled by a recording of indicators, in the event of noti cation the implementation shall provide a continuation value to be used in subsequent arithmetic operations.
Continuation values may be in i(I), c(I), i(F ) or c(F ) (as appropriate), or be special values
(where the real or imaginary component is 0, 1, +1, or a qNaN).
Floating point datatypes that satisfy the requirements of IEC 60559 have special values in addition to the values in F . These are: 0, +1, 1, signaling NaNs (sNaN), and quiet NaNs (qNaN). Such values may be components of complex oating point datatypes, and may be included in values passed as arguments to operations, and used as results or continuation values. Floating point types that do not fully conform to IEC 60559 can also have values corresponding to 0, +1, 1, or NaN.
5.5 Support for imaginary and complex numerals |
51 |
ISO/IEC WD 10967-3.1:2001(E) |
Working draft |
7Relationship with language standards
A computing system often provides some of the operations speci ed in this part within the context of a programming language. The requirements of the present standard shall be in addition to those imposed by the relevant programming language standards.
This part does not de ne the syntax of arithmetic expressions. However, programmers need to know how to reliably access the operations speci ed in this Part.
NOTE 1 { Providing the information required in this clause is properly the responsibility of programming language standards. An individual implementation would only need to provide details if it could not cite an appropriate clause of the language or binding standard.
An implementation shall document the notation that should be used to invoke an operation speci ed in this Part and made available. An implementation should document the notation that should be used to invoke an operation speci ed in this Part and that could be made available.
NOTE 2 { For example, the complex radian arc sine operation for an argument x (arcsinc(F )(x)) might be invoked as
arcsin(x) |
in Ada [7] |
casin(x) |
in C [13] |
asin(x) |
in Fortran [18] and C++ [14] |
(asin x) |
in Common Lisp [38] |
with a suitable expression of the argument (x).
An implementation shall document the semantics of arithmetic expressions in terms of compositions of the operations speci ed in clause 5 of this Part and in clause 5 of Part 1.
Compilers often \optimize" code as part of compilation. Thus, an arithmetic expression might not be executed as written. An implementation shall document the possible transformations of arithmetic expressions (or groups of expressions) that it permits. Typical transformations include
a)Insertion of operations, such as datatype conversions or changes in precision.
b)Replacing operations (or entire subexpressions) with others, such as \cos(-x)" ! \cos(x)" (exactly the same result) or \pi - arccos(x)" ! \arccos(-x)" (more accurate result).
c)Evaluating constant subexpressions.
d)Eliminating unneeded subexpressions.
Only transformations which alter the semantics of an expression (the values produced, and the noti cations generated) need be documented. Only the range of permitted transformations need be documented. It is not necessary to describe the speci c choice of transformations that will be applied to a particular expression.
The textual scope of such transformations shall be documented, and any mechanisms that provide programmer control over this process should be documented as well.
8Documentation requirements
In order to conform to this part, an implementation shall include documentation providing the following information to programmers.
52 |
Documentation requirements |
