Loading in 5 sec....

TS 18661 Part 4 Supplementary FunctionsPowerPoint Presentation

TS 18661 Part 4 Supplementary Functions

- 97 Views
- Uploaded on
- Presentation posted in: General

TS 18661 Part 4 Supplementary Functions

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

TS 18661 Part 4Supplementary Functions

WG 14 N1797

2014-04-07

IEC 60559:2011 specifies and recommends these math functions:

expexp2 exp10[−∞, +∞]

expm1 exp2m1 exp10m1 [−∞, +∞]

log log2 log10 [0, +∞]

logp1=log1p log2p1 log10p1 [−1, +∞]

hypot(x, y) [−∞, +∞] × [−∞, +∞]

rSqrt = 1/√x [0, +∞]

compound(x, n) = (1 + x)n [−1, +∞] × Z

rootn(x, n) = x1/n[−∞, +∞] × Z

pown(x, n) = xn[−∞, +∞] × Z

pow(x, y) = xy [−∞, +∞] × [−∞, +∞]

powr(x, y) = xy [0, +∞] × [−∞, +∞]

sin cos tan (−∞, +∞)

sinPi(x) = sin(π × x)and

cosPi(x) = cos(π × x) (−∞, +∞)

tanPi(x) = tan(π × x) [−∞, +∞]

atan2Pi(y, x) [−∞, +∞] × [−∞, +∞]

asinacos [−1, +1]

atan [−∞, +∞]

atan2(y, x) [−∞, +∞] × [−∞, +∞]

sinhcoshtanh [−∞, +∞]

asinh [−∞, +∞]

acosh [+1, +∞]

atanh [−1, +1]

- Some IEC 60559 math functions already in C11
- TS adds the rest, in Library 7.12 Mathematics and Annex F
- Also, for completeness
tanpi [−∞, +∞]

asinpiacospi [−1, +1]

- TS does not require IEC 60559-specified correct rounding
- Names with cr prefixes reserved for correctly rounded verisons, e.g., crsin for correctly rounded sin function

- Added tgmath macros for new functions
- Reserved names for complex versions of new functions, for binary floating types

- Added logp1 equivalent to log1p
- For consistency with log2p1 and log10p1
- And to avoid the confusing log21p and log101p

- Used compoundn for compound(x, n)
- Because of existing compound(x, y) extensions
- Fits with scalbn(x, n) and others

- Otherwise used IEC 60559 names, without camelCase (IEC 60559 does not require using its names)

- IEC 60559 and C11 Annex F treat special cases the same
- New functions follow same principles
- TS follows C11 style for specifying math errors in 7.12

IEC 60559:2011 specifies and recommends sum reduction operations on vectors p and q of length n:

sum(p, n)Σi=1,npi

dot(p, q, n)Σi=1,npi× qi

sumSquare(p, n)Σi=1,npi2

sumAbs(p, n)Σi=1,n|pi|

IEC 60559 specifies and recommends scaled product reduction operations: compute without over/underflow

pr = scaled productandsf = scale factor

such that

result product = pr×radixsf

scaledProd(p, n)∏i=1,npi

scaledProdSum(p, q, n)∏i=1,n(pi + qi)

scaledProdDiff(p, q, n)∏i=1,n(pi – qi)

IEC 60559TS 16881-4

sumreduc_sum

dotreduc_sumprod

sumSquarereduc_sumsq

sumAbsreduc_sumabs

scaledProdscaled_prod

scaledProdSumscaled_prodsum

scaledProdDiffscaled_proddiff

double reduc_sum (size_tn,

constdouble p[static n] );

double scaled_prod (size_tn,

constdouble p[static n],

intmax_t* restrict sfptr);

Arrays indexed 0 to n - 1

- Result values not fully specified like other IEC 60559 operations
- Implementation can (re)order operations and use extra range and precision, for speed and accuracy
- Must avoid over/underflow, except if final result of sum reduction deserves over/underflow

- Follows general principles for special cases, e.g.,
- reduc_sum(n, p) returns a NaN if any member of array p is a NaN.
- reduc_sum(n, p) returns a NaN and raises the “invalid” floating-point exception if any two members of array p are infinities with different signs.
- Otherwise,reduc_sum(n, p) returns ±∞ if the members of p include one or more infinities ±∞ (with the same sign).

- For scaled product:
- scaled_prod(n, p, sfptr) returns a NaN if any member of array p is a NaN.
- scaled_prod(n, p, sfptr) returns a NaN and raises the “invalid” floating-point exception if any two members of array p are a zero and an infinity.
- Otherwise,scaled_prod(n, p, sfptr) returns an infinity if any member of array p is an infinity.
- Otherwise,scaled_prod(n, p, sfptr) returns a zero if any member of array p is a zero.
- Otherwise,scaled_prod(n, p, sfptr) returns a NaN and raises the “invalid” floating-point exception if the scale factor is outside the range of the intmax_t type.