Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:

ISO,IEC 10967-3 standard.Language independent arithmetic

.pdf
Скачиваний:
24
Добавлен:
23.08.2013
Размер:
453.11 Кб
Скачать
expi(F )!c(F )
The expi(F )!c(F )

Working draft

 

 

 

 

 

 

ISO/IEC WD 10967-3.1:2001(E)

 

 

 

 

 

 

= no

 

result2c(F )(x +^ y; z +^ w)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

otherwise

 

 

 

 

 

 

 

 

EDITOR'S NOTE { -0...in nities...

 

 

 

 

 

 

For the complex sign operation, the sin

 

arcF approximation helper function is used:

 

 

 

sin

 

arc : F

 

F

! R

 

 

 

 

 

 

 

 

 

 

F

 

R

 

 

 

 

 

 

 

F

 

 

 

 

 

 

 

 

 

 

 

 

sin

 

arc (x; z) returns a close approximation to sin(arc(x; z)) in

 

, with maximum error max

 

error

 

tanF .

 

 

 

 

NOTE 2 { The arc function is de ned in LIA-2.

Further requirements on the sin

 

arcF

approximation helper function are:

 

sin

 

arc

(x; 0) = 0

 

 

 

 

 

if x

2

F and x > 0

 

 

F

(x; x) = 1=p

 

 

 

 

 

 

 

 

 

 

 

if x

F and x > 0

sin

 

arc

2

 

 

 

 

 

 

 

 

 

 

2

 

 

F

(0; z) = 1

 

 

 

 

 

if y

F and y > 0

sin

 

arc

 

 

 

 

 

2

 

 

F

(x;

 

x) = 1=p

 

 

 

 

 

 

 

 

 

if x

F and x < 0

sin

 

arc

 

2

 

 

 

 

 

 

 

2

 

 

F

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

sin

 

arc

(x; 0) = 0

 

 

 

 

 

if x

2

F and x < 0

 

 

F

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

sin

 

arc

(x;

 

y) = sin

 

arc (x; z)

 

if x; z

2

F and (y = 0 or x > 0)

 

 

F

 

 

F

 

 

 

 

 

6

The signc(F ) operation:

 

 

 

 

 

 

 

 

 

 

 

 

signc(F ) : c(F ) ! c(F ) [ funder owg

 

 

 

 

 

 

 

signc(F )(x +^ y)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

= result

(c)(F )

(sin

 

arc

(x; y)) +~

 

sin

 

arc (y; x)))

 

 

 

 

 

 

 

 

 

 

 

 

 

 

F

 

 

 

 

 

F

if x; y 2 F and x 6= 0 and y 6= 0

= sinF (arcF (x; y)) +^ cosF (arcF (x; y)) otherwise

EDITOR'S NOTE { 'inverse' hypot? should have been in LIA-2

5.3Elementary transcendental imaginary and complex oating point operations

EDITOR'S NOTE { There must be sign requirements! no monotonicity requirements??

5.3.1Operations for exponentiations and logarithms

There shall be two maximum error parameters for complex exponentiations and logarithms.

max error expc(F ) 2 F max error powerc(F ) 2 F

5.3.1.1Natural exponentiation

operation:

: i(F ) ! c(F ) [ funder ow; absolute precision under owg

expi(F )!c(F )(^ y)

= cosF (y) +^ sinF (y)

NOTE 1 { Some programming languages have the operation cis. cis(x) is expi(F )!c(F )(^ x).

The expc(F ) approximation helper function:

5.3 Elementary transcendental imaginary and complex oating point operations

23

powerc(F )
The powerc(F )

ISO/IEC WD 10967-3.1:2001(E)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Working draft

 

exp

 

:

 

C ! C

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

c(F )

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

exp

 

(z) returns a close approximation to ez in

 

C

 

with maximum error max

 

error

 

 

exp

.

c(F )

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

c(F )

 

A further requirement on the expc(F ) approximation helper function is:

 

 

exp

(conj(z)) = conj(exp

 

 

(z))

 

 

if z

 

2 C

 

 

 

c(F )

 

 

 

 

 

 

 

c(F )

 

 

 

 

 

 

 

 

 

 

The relationship to the cosF , sinF , and expF

 

approximation helper functions in an associated

library for real-valued operations shall be:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

exp

(~

 

y) = cos (y) +~

 

sin (y)

 

 

if y

 

2 R

 

 

 

c(F )

 

 

 

 

 

F

 

 

 

F

 

 

 

 

 

 

 

 

 

 

exp

(x) = exp (x)

 

 

 

 

 

 

 

if x

2 R

 

 

 

c(F )

 

 

 

 

 

 

F

 

 

 

 

 

 

 

 

 

 

 

 

 

 

EDITOR'S NOTE { ...cyclic rep. in general...

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

exp

 

(x +~

 

(2

 

+ y)) = exp

 

 

 

(x +~

 

y) ... if

j

::: < big

 

angle

 

rF

 

c(F )

 

 

 

 

 

c(F )

 

 

 

 

 

 

 

 

j

 

The expc(F ) operation:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

expc(F ) : c(F ) ! c(F ) [ funder ow; over ow; absolute

 

precision

 

under owg

 

 

 

 

 

 

expc(F )(x +^ y)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

= result

 

 

(exp

 

(x +~

 

y); nearestF )

 

 

 

 

 

 

 

 

 

 

c(F )

 

 

c(F )

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

= expc(F )(0 +^ y)

 

 

if x +^ y 2 c(F ) and jyj 6 big

 

angle

 

rF

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

if x = 0

 

 

 

 

 

 

 

 

 

 

= conj c(F )(expc(F )(x +^ 0))

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

if y = 0 and x 6= 0

 

 

 

 

 

 

 

 

 

 

= mulF (0; cosF (y)) +^ mulF (0; sinF (y))

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

if x = 1 and y 2 F and jyj 6 big

 

angle

 

rF

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

= mulF (+1; cosF (y)) +^ mulF (+1; sinF (y))

 

 

 

 

 

 

 

 

 

 

= (+1) +^ 0

 

 

if x = +1 and y 2 F and jyj 6 big

 

angle

 

rF and y 6= 0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

if x = +1 and y 2 F and y = 0

 

 

 

 

 

 

 

 

 

 

= radhc(F )(x +^ y)

otherwise

 

NOTES

2 radhc(F ) is speci ed in clause 5.3.3.1.

3 invalid is here avoided for the cases expc(F )((+1) +^ 0) and expc(F )((+1) +^ ( 0)).

5.3.1.2Complex exponentiation of argument base

approximation helper function: : C C ! C

powerc(F )(b; z) returns a close approximation to bz in C with maximum error max error powerc(F ). A further requirement on the powerc(F ) approximation helper function is:

powerc(F )(conj(b); conj(z)) = conj(powerc(F )(b; z)) if b; z 2 C

The powerc(F ) operation:

powerc(F ) : c(F ) c(F ) ! c(F )[

funder ow; over ow; absolute precision under ow; in nitary; invalidg

24

Speci cations for imaginary and complex datatypes and operations

Working draft

 

 

 

 

 

 

ISO/IEC WD 10967-3.1:2001(E)

powerc(F )(x +^ y; z +^ z0)

 

 

 

 

 

 

 

 

 

 

 

 

= result

(power

(x +~

 

y; z +~

 

z0); nearestF )

c(F )

c(F )

 

 

 

 

 

 

z0

 

c(F ) and x = 0 and

 

 

if x +^

 

y; z +^

 

2

 

 

 

 

 

 

 

 

 

6

 

 

jz0 ln(jxj)j is not too large...?

= powerc(F )(0 +^ y; z +^ z0)

 

 

 

 

 

 

 

 

 

 

if x = 0 (?)

 

 

 

 

=??????

 

if y = 0 and x 6= 0

= powerc(F )(x +^ y; 0 +^ z0)

 

 

 

 

 

 

 

 

 

 

if z = 0

 

 

 

 

 

 

= conj c(F )(powerc(F )(x +^ y; z +^ 0))

 

 

 

 

 

 

if z0 = 0 (?)

 

 

 

 

= expc(F )(mulc(F )(lnc(F )(x +^ y); z +^ z0))

 

 

 

 

otherwise

 

 

 

 

 

 

NOTE { Complex raising to a power is multi-valued.

 

The principal result is given by

bq = eq ln(b). The bq function branch cuts at fx j x 2 R and x < 0g C (except when q is in

Z). Thus powerc(F )(x +^ 0; z) 6= powerc(F )(x +^ ( 0); z).

5.3.1.3Complex square root

The sqrtF !c(F ) operation: sqrtF !c(F ) : F ! c(F )

sqrtF !c(F )(x) = 0 +^ sqrtF (negF (x)) if (x 2 F and x < 0) or x 2 f1; 0g

=sqrtF (x) +^ ( 0) if (x 2 F and x > 0) or x = +1

=no resultc(F )(x +^ imF (x))

otherwise

The sqrti(F )!c(F ) operation: sqrti(F )!c(F ) : F ! c(F )

sqrti(F )!c(F )(^ y)

= sqrtc(F )(imF (y) +^ y) The sqrtc(F ) approximation helper function:

sqrtc(F ) : C ! C

p

sqrtc(F )(z) returns a close approximation to z in C with maximum error max error expc(F ). Further requirements on the sqrtc(F ) approximation helper function are:

sqrt

(conj(z)) = conj(sqrt

(z))

 

if z

2 C

 

 

 

c(F )

(x) = p

 

 

 

 

 

c(F )

 

 

 

 

if x

and x

>

0

sqrt

 

 

 

 

 

 

 

 

 

 

2 R

x

 

 

 

 

 

 

 

 

c(F )

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

sqrt

(x) = ~

 

sqrt

(

 

x)

 

 

 

 

 

if x

2 R

and x < 0

c(F )

 

 

 

 

 

c(F )

 

 

 

 

 

 

 

 

 

 

 

>

 

Re(sqrt

(~

 

y)) = Im(sqrt

(~

 

y))

if y

2 R

and y

0

 

c(F )

 

 

 

 

 

 

 

c(F )

 

 

 

 

 

 

 

 

The sqrtc(F ) operation:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

sqrtc(F ) : c(F ) ! c(F )

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

sqrtc(F )(x +^ y)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

= result

 

(sqrt

 

(x +~

 

y); nearestF )

 

 

 

 

 

 

 

 

 

 

 

c(F )

 

c(F )

 

 

 

 

 

 

 

 

 

 

 

 

 

= sqrtc(F )(0 +^ y)

 

if x +^ y 2 c(F )

 

 

 

 

 

 

 

 

if x = 0 and y 2 F [ f1; +1g

5.3.1 Operations for exponentiations and logarithms

25

= lnc(F )(0 +^ y)
= conj c(F )

ISO/IEC WD 10967-3.1:2001(E)

Working draft

= ( 0) +^ ( 0)

if x = 0 and y = 0

= conj c(F )(sqrtc(F )(x +^ 0))

= (+1) +^ (+1)

if x 2 F [ f1; +1g and y = 0

if x 2 F [ f1; 0; +1g and y = +1

= (+1) +^ 0

if x = +1 and y 2 F and x > 0

= (+1) +^ ( 0)

if x = +1 and ((y 2 F and y < 0 or y = 0)

= (+1) +^ (1)

if x 2 F [ f1; 0; +1g and y = 1

= 0 +^ (+1)

if x = 1 and y 2 F and x > 0

= 0 +^ (1)

if x = 1 and ((y 2 F and y < 0 or y = 0)

= no

 

resultc(F )(x +^ y)

otherwise

 

 

 

 

NOTE { The inverse of complex square is multi-valued. The principal result is given by pb = e0:5 ln(b). The p function branch cuts at fx j x 2 R and x < 0g. Thus sqrtc(F )(x+^ 0) 6= sqrtc(F )(x +^ ( 0)) when x < 0.

5.3.1.4Natural logarithm

The lnF !c(F ) operation:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

lnF !c(F ) : F ! c(F ) [ fin nitaryg

 

 

 

 

 

 

 

 

 

 

 

 

 

lnF !c(F )(x)

 

 

 

= lnF (absF (x)) +^ arcF (x; imF (x))

 

 

 

 

 

 

 

The lni(F )!c(F ) operation:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

lni(F )!c(F ) : F ! c(F ) [ fin nitaryg

 

 

 

 

 

 

 

 

 

 

 

 

 

lni(F )!c(F )(^ y)

= lnF (absF (y)) +^ arcF (rei(F )(y); y)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

The lnc(F ) approximation helper function:

 

 

 

 

 

 

 

 

 

 

 

 

 

ln

:

C ! C

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

c(F )

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

ln

 

(z) returns a close approximation to ln(z) in

C

with maximum error max

 

error

 

exp

.

c(F )

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

c(F )

 

 

A further requirement on the lnc(F ) approximation helper function is:

 

 

 

ln

(conj(z)) = conj(ln

 

(z))

 

 

 

 

 

if z

2 C

 

 

 

 

 

 

 

 

 

c(F )

 

 

 

 

 

 

 

c(F )

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

The relationship to the arcF

and lnF

approximation helper functions in an associated library

for real-valued operations shall be:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Im(ln

 

 

(x +~

 

y)) = arc (x; y)

 

 

 

 

 

if x; y

2 R

 

 

 

 

 

 

 

 

 

 

c(F )

 

 

 

 

F

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Re(ln

 

(x +~

 

y)) = ln

( x +~

 

y

)

 

if x; y

2 R

and (x = 0 or y = 0)

 

 

 

 

 

c(F )

 

 

 

 

F

j

 

 

 

j

 

 

 

 

 

 

 

 

 

 

 

 

The lnc(F ) operation:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

lnc(F ) : c(F ) ! c(F ) [ fin nitaryg

 

 

 

 

 

 

 

 

 

 

 

 

 

 

ln

c(F )

(x +^

 

y)

 

= result

 

 

(ln

 

 

(x +~

 

y); nearestF )

 

 

 

 

 

 

 

 

 

 

c(F )

c(F )

 

 

 

 

 

 

 

 

 

 

 

 

if x +^ y 2 c(F ) and (x 6= 0 or y 6= 0) = in nitary((1) +^ arcF (x; y))

if x; y 2 f 0; 0g

(lnc(F )(x +^ 0))

if y = 0

if x = 0 and x 2 F and y 6= 0

26

Speci cations for imaginary and complex datatypes and operations

logbasec(F )

Working draft

ISO/IEC WD 10967-3.1:2001(E)

=(+1) +^ arcF (x; y) if x 2 f 1; +1g and y 2 F [ f 1; +1g

=(+1) +^ arcF (x; y) if x 2 F and y 2 f 1; +1g

=no resultc(F )(x +^ y)

otherwise

NOTES

1The inverse of natural exponentiation 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 ln function (returning the principle value for the inverse) branch cuts at fx j x 2 R and x < 0g, is

continuous on the rest of C, and ln(z) 2 R if x 2 R and x > 0. Thus lnc(F )(x +^ 0) 6= lnc(F )(x +^ ( 0)) when x < 0.

2rec(F )(lnc(F )(x +^ y)) lnF (hypotF (x; y)) and

imc(F )(lnc(F )(x +^ y)) = arcF (x; y) when there is no noti cation.

5.3.1.5Argument base logarithm

The logbasec(F ) approximation helper function:

logbasec(F ) : C C ! C

logbasec(F )(b; z) returns a close approximation to logb(z) in C with maximum error max error powerc(F ). A further requirement on the logbasec(F ) approximation helper function is:

logbasec(F )(conj(b); conj(z)) = conj(logbasec(F )(b; z)) if b; z 2 C

The logbasec(F ) operation:

: c(F ) c(F ) ! c(F [ f 0g) [ fin nitary; invalidg

logbasec(F )(x +^ y; z +^ z0)

= resultc(F )(logbasec(F )(x +~ y; z +~ z0); nearestF )

if x +^ y; z +^ z0 2 c(F ) and x 6= 0 = divc(F )(lnc(F )(z +^ z0); lnc(F )(x +^ y))

otherwise

NOTE { Complex logarithm with argument base is multi-valued. The principal result is given by logb(q) = ln(q)= ln(b). Apart from the poles, the logb(q) function branch cuts at (fx j x 2 R and x < 0g C) [ (C fx j x 2 R and x < 0g).

5.3.2Operations for radian trigonometric elementary functions

There shall be two maximum error parameters for complex trigonometric operations.

max error sinc(F ) 2 F max error tanc(F ) 2 F

5.3.2.1 Radian angle normalisation

 

radi(F ) : i(F ) ! i(F )

if y 2 F [ f 1; 0; +1; qNaNg

radi(F )(^ y) = ^ y

= invalid(^ qNaN)

if y is a signalling NaN

5.3.2 Operations for radian trigonometric elementary functions

27

ISO/IEC WD 10967-3.1:2001(E)

 

 

 

Working draft

radc(F ) : c(F ) ! c(F ) [ fabsolute

 

precision

 

under owg

 

 

radc(F )(x +^ y)

 

if y 2 F [ f1; 0; +1g and radF (x) 2 F [ f 0g

= radF (x) +^ y

 

= absolute precision under ow(qNaN +^ qNaN) if y 2 F [ f1; 0; +1g and

radF (x) = absolute precision under ow

=no resultc(F )(x +^ y) otherwise

5.3.2.2Radian sine

NOTE { sin( z) = sin(z) sin(conj(z)) = conj(sin(z))

sin(z + k 2 ) = sin(z) if k 2 Z sin(z) = cos( =2 z)

sin(x) = ~ sinh(~ x) = ~ sinh( ~ x) sin(~ y) = ~ sinh( y) = ~ sinh(y)

sin(x +~ y) = ~ sinh( y +~ x) = ~ sinh(y ~ x)

sin(x +~ y) = sin(x) cosh(y) +~ cos(x) sinh(y)

The sini(F ) operation:

 

 

 

 

 

 

 

 

 

 

 

 

sini(F ) : i(F ) ! i(F ) [ fover owg

 

 

 

 

 

 

 

 

 

 

sini(F )(^ y)

 

= ^ sinhF (y)

 

 

 

 

 

 

 

 

 

 

The sinc(F ) approximation helper function:

 

 

 

 

 

 

 

 

 

sin

:

C ! C

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

c(F )

 

 

 

 

 

 

 

 

 

 

 

 

 

 

sin

 

(z) returns a close approximation to sin(z) in

C

with maximum error max

 

error

 

sin

c(F )

.

c(F )

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Further requirements on the sinc(F ) approximation helper function are:

 

 

 

sin

(conj(z)) = conj(sin

(z))

if z

2 C

 

 

 

 

c(F )

 

 

 

 

 

 

c(F )

 

 

 

 

 

sin

(

 

z) =

 

sin

(z)

 

if z

2 C

 

 

 

 

c(F )

 

 

 

c(F )

 

 

 

 

 

The relationship to the sinF and sinhF

approximation helper functions in an associated library

for real-valued operations shall be:

 

 

 

 

 

 

 

 

 

 

 

sin

(x) = sin

(x)

 

 

if x

2 R

 

 

 

 

c(F )

(~

 

y) = ~

F

 

(y)

 

if y

 

 

 

sin

 

 

sinh

 

2 R

 

 

 

 

c(F )

 

 

 

F

 

 

 

 

 

The requirements implied by these relationships and the requirements from part 2 remain even if there is no sinF or sinhF operations in any associated library for real-valued operations or there is no associated library for real-valued operations. EDITOR'S NOTE { generalise the preceding requirement to all operations

The sinc(F ) operation:

sinc(F ) : c(F ) ! c(F ) [ funder ow; over ow; absolute precision under owg

28

Speci cations for imaginary and complex datatypes and operations

Working draft

 

 

 

 

ISO/IEC WD 10967-3.1:2001(E)

sinc(F )(x +^ y)

= result

(sin

(x +~

 

y); nearestF )

 

 

 

 

 

 

c(F )

c(F )

 

 

 

 

 

 

 

 

 

 

 

 

if x +^ y 2 c(F ) and jxj 6 big

 

angle

 

rF

 

 

 

 

 

 

 

 

 

 

 

= conj c(F )(sinc(F )(x +^ 0))

 

 

 

 

 

 

if y = 0

 

 

 

= negc(F )(sinc(F )(0 +^ negF (y)))

 

 

 

= 0 +^ y

 

 

if x = 0 and y 6= 0

 

 

 

 

 

if x = 0 and y 2 f1; +1g

 

 

 

= mulF (+1; sinF (x)) +^ mulF (y; cosF (x))

 

 

 

= radc(F )(x +^ y)

 

if x 62f0; 0g and y 2 f1; +1g

 

 

 

 

otherwise

5.3.2.3 Radian cosine

 

 

 

 

 

 

 

 

NOTE

{ cos( z) = cos(z)

 

 

 

 

 

 

 

 

cos(conj(z)) = conj(cos(z))

 

 

 

 

 

 

 

 

cos(z + k 2 ) = cos(z) if k 2 Z

 

 

 

 

 

 

 

cos(z) = sin( =2 z)

 

 

 

 

 

 

 

 

cos(x) = cosh(~ x) = cosh( ~ x)

 

 

 

 

 

 

 

cos(~ y) = cosh(y)

 

 

 

 

 

 

 

 

cos(x +~ y) = cosh( y +~ x) = cosh(y ~ x)

 

 

 

 

 

cos(x +~ y) = cos(x) cosh(y) +~ sin(x) sinh(y)

The cosi(F ) operation:

 

 

 

 

 

 

 

 

cosi(F ) : i(F ) ! F [ fover owg

 

 

 

 

 

 

 

cosi(F )(^ y)

= coshF (y)

 

 

 

 

 

 

 

 

The cosc(F ) approximation helper function:

 

 

 

 

 

 

cos

:

C ! C

 

 

 

 

 

 

 

 

 

c(F )

 

 

 

 

 

 

 

 

 

 

cosc(F )(z) returns a close approximation to cos(z) in C with maximum error max error sinc(F ). Further requirements on the cosc(F ) approximation helper function are:

cos

(conj(z)) = conj(cos

(z))

if z

2 C

c(F )

 

 

 

c(F )

 

 

cos

(

 

z) = cos

(z)

 

if z

2 C

c(F )

 

c(F )

 

 

 

The relationship to the cosF and coshF approximation helper functions in an associated library for real-valued operations shall be:

cos

(x) = cos

(x)

 

if x

2 R

c(F )

 

 

F

 

 

 

cos

(~

 

y) = cosh

(y)

if y

2 R

c(F )

 

 

F

 

 

The cosc(F ) operation:

cosc(F ) : c(F ) ! c(F ) [ funder ow; over ow; absolute precision under owg

cosc(F )(x +^ y)

= resultc(F )(cosc(F )(x +~ y); nearestF )

if x +^ y 2 c(F ) and jxj 6 big angle rF

= conj c(F )(cosc(F )(x +^ 0))

5.3.2 Operations for radian trigonometric elementary functions

29

ISO/IEC WD 10967-3.1:2001(E)

Working draft

= cosc(F )(0 +^ negF (y))

if y = 0

if x = 0 and y 6= 0

 

= (+1) +^ negF (divF (1; y))

 

if x = 0 and y 2 f1; +1g

= mulF (+1; cosF (x)) +^ mulF (negF (divF (1; y)); sinF (x))

= radc(F )(x +^ y)

if y = +1 and x 62f0; 0g

otherwise

5.3.2.4 Radian tangent

NOTE { tan( z) = tan(z) tan(conj(z)) = conj(tan(z))

tan(z + k 2 ) = tan(z) if k 2 Z tan(z) = cot( =2 z)

tan(x) = ~ tanh(~ x) = ~ tanh( ~ x) tan(~ y) = ~ tanh( y) = ~ tanh(y)

tan(x +~ y) = ~ tanh( y +~ x) = ~ tanh(y ~ x)

The tani(F ) operation:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

tani(F ) : i(F ) ! i(F )

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

tani(F )(^ y)

 

= ^ tanhF (y)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

The tanc(F ) approximation helper function:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

tan

:

C ! C

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

c(F )

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

tan

 

(z) returns a close approximation to tan(z) in

C

with maximum error max

 

error

 

tan

c(F )

.

c(F )

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Further requirements on the tanc(F ) approximation helper function are:

 

 

 

tan

(conj(z)) = conj(tan

 

(z))

 

if z

2 C

 

 

 

 

 

 

 

 

 

 

 

 

 

c(F )

 

 

 

 

 

 

 

c(F )

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

tan

(

 

z) =

 

tan

(z)

 

 

 

if z

2 C

 

 

 

 

 

 

 

 

 

 

 

 

 

c(F )

 

 

 

 

c(F )

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

The relationship to the tanF and tanhF

approximation helper functions in an associated library

for real-valued operations shall be:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

tan

(x) = tan

(x)

 

 

 

 

if x

2 R

 

 

 

 

c(F )

(~

 

y) = ~

F

 

(y)

 

 

 

if y

 

 

 

tan

 

 

tanh

 

 

 

2 R

 

 

 

 

c(F )

 

 

 

 

F

 

 

 

 

 

 

 

 

The tanc(F ) operation:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

tanc(F ) : c(F ) ! c(F ) [ funder ow; over ow; absolute

 

precision

 

under owg

 

 

 

 

 

 

 

 

tanc(F )(x +^ y)

= result

(tan

(x +~

 

y); nearestF )

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

c(F )

 

c(F )

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

if x +^ y 2 c(F ) and jxj 6 big angle rF

= conj c(F )(tanc(F )(x +^ 0))

if y = 0

= negF (tanc(F )(0 +^ negF (y)))

if x = 0 and y 6= 0

= mulF (0; tanF (x)) +^ tanhF (y)

if y 2 f1; +1g

30

Speci cations for imaginary and complex datatypes and operations

Working draft

 

 

 

 

 

 

 

 

 

ISO/IEC WD 10967-3.1:2001(E)

 

 

 

 

 

 

 

= radc(F )(x +^ y)

 

otherwise

 

 

5.3.2.5 Radian cotangent

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

NOTE

 

{

 

cot( z) = cot(z)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

cot(conj(z)) = conj(cot(z))

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

cot(z + k 2 ) = coth(z) if k 2 Z

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

cot(z) = tan( =2 z)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

cot(z) = 1= tan(z)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

cot(x) = ~ coth(~ x) = ~ coth( ~ x)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

cot(~ y) = ~ coth( y) = ~ coth(y)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

cot(x +~ y) = ~ coth( y +~ x) = ~ coth(y ~ x)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

The coti(F ) operation:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

coti(F ) : i(F ) ! i(F ) [ fover ow; in nitaryg

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

coti(F )(^ y)

= negi(F )(^ cothF (y))

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

The cotc(F ) approximation helper function:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

cot

:

C ! C

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

c(F )

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

cot

 

(z) returns a close approximation to cot(z) in

C

with maximum error max

 

error

 

tan

c(F )

.

c(F )

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Further requirements on the cotc(F ) approximation helper function are:

 

 

 

cot

(conj(z)) = conj(cot

 

(z))

 

if z

2 C

 

 

 

 

c(F )

 

 

 

 

 

 

c(F )

 

 

 

 

 

 

 

cot

(

 

z) =

cot

(z)

 

 

 

if z

2 C

 

 

 

 

c(F )

 

 

 

c(F )

 

 

 

 

 

 

 

 

The relationship to the cotF and cothF

approximation helper functions in an associated library

for real-valued operations shall be:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

cot

(x) = cot (x)

 

 

 

 

if x

2 R

 

 

 

 

c(F )

 

 

 

 

F

 

 

 

 

 

 

 

 

 

 

cot

(~

 

y) =

~

coth (y)

 

 

 

if y

2 R

 

 

 

 

c(F )

 

 

 

 

 

F

 

 

 

 

 

 

 

The cotc(F ) operation:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

cotc(F ) : c(F ) ! c(F ) [ funder ow; over ow; in nitary; absolute

 

precision

 

 

under owg

 

 

 

 

 

cotc(F )(x +^ y)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

= result

(cot

(x +~

 

y); nearestF )

 

 

 

 

 

 

 

 

 

 

 

c(F )

 

c(F )

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

if x +^ y 2 c(F ) and jxj 6 big

 

angle

 

rF and

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

(x 6= 0 or y 6= 0)

 

 

 

 

 

 

 

 

 

= in nitary((+1) +^ (+1))

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

if x = 0 and y = 0

 

 

 

 

 

 

 

 

 

= conj c(F )(tanc(F )(x +^ 0))

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

if y = 0

 

 

 

 

 

 

 

 

 

= negF (tanc(F )(0 +^ negF (y)))

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

if x = 0 and y 6= 0

 

 

 

 

 

 

 

 

 

= mulF (0; tanF (x)) +^ negF (tanhF (y))

 

 

 

 

 

 

 

 

 

= radc(F )(x +^ y)

 

if y 2 f1; +1g

 

 

 

 

 

 

 

 

 

 

otherwise

 

 

5.3.2 Operations for radian trigonometric elementary functions

31

ISO/IEC WD 10967-3.1:2001(E)

Working draft

5.3.2.6Radian secant

NOTE { sec( z) = sec(z) sec(conj(z)) = conj(sec(z))

sec(z + k 2 ) = sec(z) if k 2 Z sec(z) = csc( =2 z)

sec(z) = 1= cos(z)

sec(x) = sech(~ x) = sech( ~ x) sec(~ y) = sech( y) = sech(y)

sec(x +~ y) = sech( y +~ x) = sech(y ~ x)

The seci(F ) operation:

seci(F ) : i(F ) ! i(F ) [ funder owg seci(F )(^ y) = negi(F )(^ sechF (y))

The secc(F ) approximation helper function:

secc(F ) : C ! C

secc(F )(z) returns a close approximation to sec(z) in C with maximum error max error tanc(F ).

Further requirements on the secc(F ) approximation helper function are:

sec

(conj(z)) = conj(sec

 

(z))

 

if z

2 C

c(F )

 

 

 

 

 

 

 

c(F )

 

 

 

 

sec

(

 

z) =

 

sec

(z)

 

 

 

if z

2 C

c(F )

 

 

 

c(F )

 

 

 

 

 

 

The relationship to the secF and sechF

approximation helper functions in an associated library

for real-valued operations shall be:

 

 

 

 

 

 

 

 

 

sec

(x) = sec (x)

 

 

 

 

if x

2 R

c(F )

 

 

 

 

F

 

 

 

 

 

 

 

sec

(~

 

y) =

 

~

sech (y)

 

 

 

if y

2 R

c(F )

 

 

 

 

 

F

 

 

 

 

 

The secc(F ) operation:

 

 

 

 

 

 

 

 

 

 

 

secc(F ) : c(F ) ! c(F ) [ funder ow; over ow; absolute

 

precision

 

under owg

 

 

secc(F )(x +^ y)

= result

(sec

(x +~

 

y); nearestF )

 

 

 

 

 

 

 

 

 

 

 

 

 

 

c(F )

 

c(F )

 

 

 

 

 

 

 

if x +^ y 2 c(F ) and jxj 6 big angle rF

= conj c(F )(secc(F )(x +^ 0))

if y = 0

= secc(F )(0 +^ negF (y))

if x = 0 and y 6= 0

= mulF (0; cosF (x)) +^ mulF (divF ( 1; y); sinF (x))

= radc(F )(x +^ y)

if y 2 f1; +1g

otherwise

5.3.2.7Radian cosecant

NOTE { csc( z) = csc(z) csc(conj(z)) = conj(csc(z))

csc(z + k 2 ) = csc(z) if k 2 Z csc(z) = sec(~ =2 z)

32

Speci cations for imaginary and complex datatypes and operations