Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
3362 | Serge | 1 | |
2 | /* |
||
3 | * ==================================================== |
||
4 | * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. |
||
5 | * |
||
6 | * Developed at SunPro, a Sun Microsystems, Inc. business. |
||
7 | * Permission to use, copy, modify, and distribute this |
||
8 | * software is freely granted, provided that this notice |
||
9 | * is preserved. |
||
10 | * ==================================================== |
||
11 | */ |
||
12 | |||
13 | |||
14 | FUNCTION |
||
15 | < |
||
16 | INDEX |
||
17 | remainder |
||
18 | INDEX |
||
19 | remainderf |
||
20 | |||
21 | |||
22 | #include |
||
23 | double remainder(double <[x]>, double <[y]>); |
||
24 | float remainderf(float <[x]>, float <[y]>); |
||
25 | |||
26 | |||
27 | #include |
||
28 | double remainder(<[x]>,<[y]>) |
||
29 | double <[x]>, <[y]>; |
||
30 | float remainderf(<[x]>,<[y]>) |
||
31 | float <[x]>, <[y]>; |
||
32 | |||
33 | |||
34 | < |
||
35 | <[x]>/<[y]>; this value is in the range -<[y]>/2 .. +<[y]>/2. |
||
36 | |||
37 | |||
38 | < |
||
39 | |||
40 | |||
41 | < |
||
42 | < |
||
43 | |||
44 | |||
45 | |||
46 | |||
47 | * wrapper remainder(x,p) |
||
48 | */ |
||
49 | |||
50 | |||
51 | #include |
||
52 | |||
53 | |||
54 | |||
55 | |||
56 | double remainder(double x, double y) /* wrapper remainder */ |
||
57 | #else |
||
58 | double remainder(x,y) /* wrapper remainder */ |
||
59 | double x,y; |
||
60 | #endif |
||
61 | { |
||
62 | #ifdef _IEEE_LIBM |
||
63 | return __ieee754_remainder(x,y); |
||
64 | #else |
||
65 | double z; |
||
66 | struct exception exc; |
||
67 | z = __ieee754_remainder(x,y); |
||
68 | if(_LIB_VERSION == _IEEE_ || isnan(y)) return z; |
||
69 | if(y==0.0) { |
||
70 | /* remainder(x,0) */ |
||
71 | exc.type = DOMAIN; |
||
72 | exc.name = "remainder"; |
||
73 | exc.err = 0; |
||
74 | exc.arg1 = x; |
||
75 | exc.arg2 = y; |
||
76 | exc.retval = 0.0/0.0; |
||
77 | if (_LIB_VERSION == _POSIX_) |
||
78 | errno = EDOM; |
||
79 | else if (!matherr(&exc)) { |
||
80 | errno = EDOM; |
||
81 | } |
||
82 | if (exc.err != 0) |
||
83 | errno = exc.err; |
||
84 | return exc.retval; |
||
85 | } else |
||
86 | return z; |
||
87 | #endif |
||
88 | } |
||
89 | |||
90 | |||
91 |