17 feclearexcept (FE_ALL_EXCEPT
);
18 if (nextafterf (m
, i
) != i
)
20 puts ("nextafterf+ failed");
23 if (fetestexcept (FE_OVERFLOW
) == 0)
25 puts ("nextafterf+ did not overflow");
28 feclearexcept (FE_ALL_EXCEPT
);
29 if (nextafterf (-m
, -i
) != -i
)
31 puts ("nextafterf- failed");
34 if (fetestexcept (FE_OVERFLOW
) == 0)
36 puts ("nextafterf- did not overflow");
42 feclearexcept (FE_ALL_EXCEPT
);
43 i
= nextafterf (m
, i
);
44 if (i
< 0 || i
>= FLT_MIN
)
46 puts ("nextafterf+ failed");
49 if (fetestexcept (FE_UNDERFLOW
) == 0)
51 puts ("nextafterf+ did not underflow");
55 feclearexcept (FE_ALL_EXCEPT
);
56 i
= nextafterf (-m
, -i
);
57 if (i
> 0 || i
<= -FLT_MIN
)
59 puts ("nextafterf- failed");
62 if (fetestexcept (FE_UNDERFLOW
) == 0)
64 puts ("nextafterf- did not underflow");
68 feclearexcept (FE_ALL_EXCEPT
);
69 m
= nextafterf (zero
, inf
);
70 if (m
< 0.0 || m
>= FLT_MIN
)
72 puts ("nextafterf+ failed");
75 if (fetestexcept (FE_UNDERFLOW
) == 0)
77 puts ("nextafterf+ did not underflow");
80 feclearexcept (FE_ALL_EXCEPT
);
81 if (nextafterf (m
, i
) != 0.0)
83 puts ("nextafterf+ failed");
86 if (fetestexcept (FE_UNDERFLOW
) == 0)
88 puts ("nextafterf+ did not underflow");
91 feclearexcept (FE_ALL_EXCEPT
);
92 m
= nextafterf (copysignf (zero
, -1.0), -inf
);
93 if (m
> 0.0 || m
<= -FLT_MIN
)
95 puts ("nextafterf- failed");
98 if (fetestexcept (FE_UNDERFLOW
) == 0)
100 puts ("nextafterf- did not underflow");
103 feclearexcept (FE_ALL_EXCEPT
);
104 if (nextafterf (m
, -i
) != 0.0)
106 puts ("nextafterf- failed");
109 if (fetestexcept (FE_UNDERFLOW
) == 0)
111 puts ("nextafterf- did not underflow");
115 double di
= INFINITY
;
117 feclearexcept (FE_ALL_EXCEPT
);
118 if (nextafter (dm
, di
) != di
)
120 puts ("nextafter+ failed");
123 if (fetestexcept (FE_OVERFLOW
) == 0)
125 puts ("nextafter+ did not overflow");
128 feclearexcept (FE_ALL_EXCEPT
);
129 if (nextafter (-dm
, -di
) != -di
)
131 puts ("nextafter failed");
134 if (fetestexcept (FE_OVERFLOW
) == 0)
136 puts ("nextafter- did not overflow");
142 feclearexcept (FE_ALL_EXCEPT
);
143 di
= nextafter (dm
, di
);
144 if (di
< 0 || di
>= DBL_MIN
)
146 puts ("nextafter+ failed");
149 if (fetestexcept (FE_UNDERFLOW
) == 0)
151 puts ("nextafter+ did not underflow");
155 feclearexcept (FE_ALL_EXCEPT
);
156 di
= nextafter (-dm
, -di
);
157 if (di
> 0 || di
<= -DBL_MIN
)
159 puts ("nextafter- failed");
162 if (fetestexcept (FE_UNDERFLOW
) == 0)
164 puts ("nextafter- did not underflow");
168 feclearexcept (FE_ALL_EXCEPT
);
169 dm
= nextafter (zero
, inf
);
170 if (dm
< 0.0 || dm
>= DBL_MIN
)
172 puts ("nextafter+ failed");
175 if (fetestexcept (FE_UNDERFLOW
) == 0)
177 puts ("nextafter+ did not underflow");
180 feclearexcept (FE_ALL_EXCEPT
);
181 if (nextafter (dm
, di
) != 0.0)
183 puts ("nextafter+ failed");
186 if (fetestexcept (FE_UNDERFLOW
) == 0)
188 puts ("nextafter+ did not underflow");
191 feclearexcept (FE_ALL_EXCEPT
);
192 dm
= nextafter (copysign (zero
, -1.0), -inf
);
193 if (dm
> 0.0 || dm
<= -DBL_MIN
)
195 puts ("nextafter- failed");
198 if (fetestexcept (FE_UNDERFLOW
) == 0)
200 puts ("nextafter- did not underflow");
203 feclearexcept (FE_ALL_EXCEPT
);
204 if (nextafter (dm
, -di
) != 0.0)
206 puts ("nextafter- failed");
209 if (fetestexcept (FE_UNDERFLOW
) == 0)
211 puts ("nextafter- did not underflow");
215 #ifndef NO_LONG_DOUBLE
216 long double li
= INFINITY
;
217 long double lm
= LDBL_MAX
;
218 feclearexcept (FE_ALL_EXCEPT
);
219 if (nextafterl (lm
, li
) != li
)
221 puts ("nextafterl+ failed");
224 if (fetestexcept (FE_OVERFLOW
) == 0)
226 puts ("nextafterl+ did not overflow");
229 feclearexcept (FE_ALL_EXCEPT
);
230 if (nextafterl (-lm
, -li
) != -li
)
232 puts ("nextafterl failed");
235 if (fetestexcept (FE_OVERFLOW
) == 0)
237 puts ("nextafterl- did not overflow");
243 feclearexcept (FE_ALL_EXCEPT
);
244 li
= nextafterl (lm
, li
);
245 if (li
< 0 || li
>= LDBL_MIN
)
247 puts ("nextafterl+ failed");
250 if (fetestexcept (FE_UNDERFLOW
) == 0)
252 puts ("nextafterl+ did not underflow");
256 feclearexcept (FE_ALL_EXCEPT
);
257 li
= nextafterl (-lm
, -li
);
258 if (li
> 0 || li
<= -LDBL_MIN
)
260 puts ("nextafterl- failed");
263 if (fetestexcept (FE_UNDERFLOW
) == 0)
265 puts ("nextafterl- did not underflow");
269 feclearexcept (FE_ALL_EXCEPT
);
270 lm
= nextafterl (zero
, inf
);
271 if (lm
< 0.0 || lm
>= LDBL_MIN
)
273 puts ("nextafterl+ failed");
276 if (fetestexcept (FE_UNDERFLOW
) == 0)
278 puts ("nextafterl+ did not underflow");
281 feclearexcept (FE_ALL_EXCEPT
);
282 if (nextafterl (lm
, li
) != 0.0)
284 puts ("nextafterl+ failed");
287 if (fetestexcept (FE_UNDERFLOW
) == 0)
289 puts ("nextafterl+ did not underflow");
292 feclearexcept (FE_ALL_EXCEPT
);
293 lm
= nextafterl (copysign (zero
, -1.0), -inf
);
294 if (lm
> 0.0 || lm
<= -LDBL_MIN
)
296 puts ("nextafterl- failed");
299 if (fetestexcept (FE_UNDERFLOW
) == 0)
301 puts ("nextafterl- did not underflow");
304 feclearexcept (FE_ALL_EXCEPT
);
305 if (nextafterl (lm
, -li
) != 0.0)
307 puts ("nextafterl- failed");
310 if (fetestexcept (FE_UNDERFLOW
) == 0)
312 puts ("nextafterl- did not underflow");