xref: /onnv-gate/usr/src/lib/libast/common/port/astmath.c (revision 12068:08a39a083754)
14887Schin /***********************************************************************
24887Schin *                                                                      *
34887Schin *               This software is part of the ast package               *
4*12068SRoger.Faulkner@Oracle.COM *          Copyright (c) 1985-2010 AT&T Intellectual Property          *
54887Schin *                      and is licensed under the                       *
64887Schin *                  Common Public License, Version 1.0                  *
78462SApril.Chin@Sun.COM *                    by AT&T Intellectual Property                     *
84887Schin *                                                                      *
94887Schin *                A copy of the License is available at                 *
104887Schin *            http://www.opensource.org/licenses/cpl1.0.txt             *
114887Schin *         (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9)         *
124887Schin *                                                                      *
134887Schin *              Information and Software Systems Research               *
144887Schin *                            AT&T Research                             *
154887Schin *                           Florham Park NJ                            *
164887Schin *                                                                      *
174887Schin *                 Glenn Fowler <gsf@research.att.com>                  *
184887Schin *                  David Korn <dgk@research.att.com>                   *
194887Schin *                   Phong Vo <kpv@research.att.com>                    *
204887Schin *                                                                      *
214887Schin ***********************************************************************/
224887Schin /*
234887Schin  * used to test if -last requires -lm
244887Schin  *
254887Schin  *	arch		-last			-lm
264887Schin  *	----		-----			---
274887Schin  *	linux.sparc	sfdlen,sfputd		frexp,ldexp
284887Schin  */
294887Schin 
308462SApril.Chin@Sun.COM #if N >= 8
318462SApril.Chin@Sun.COM #define _ISOC99_SOURCE	1
328462SApril.Chin@Sun.COM #endif
338462SApril.Chin@Sun.COM 
344887Schin #include <math.h>
354887Schin 
364887Schin int
main()374887Schin main()
384887Schin {
394887Schin #if N & 1
404887Schin 	long double	value = 0;
414887Schin #else
424887Schin 	double		value = 0;
434887Schin #endif
444887Schin #if N < 5
454887Schin 	int		exp = 0;
464887Schin #endif
474887Schin 
484887Schin #if N == 1
494887Schin 	return ldexpl(value, exp) != 0;
504887Schin #endif
514887Schin #if N == 2
524887Schin 	return ldexp(value, exp) != 0;
534887Schin #endif
544887Schin #if N == 3
554887Schin 	return frexpl(value, &exp) != 0;
564887Schin #endif
574887Schin #if N == 4
584887Schin 	return frexp(value, &exp) != 0;
594887Schin #endif
604887Schin #if N == 5
614887Schin 	return isnan(value);
624887Schin #endif
634887Schin #if N == 6
644887Schin 	return isnan(value);
654887Schin #endif
668462SApril.Chin@Sun.COM #if N == 7
678462SApril.Chin@Sun.COM 	return copysign(1.0, value) < 0;
688462SApril.Chin@Sun.COM #endif
698462SApril.Chin@Sun.COM #if N == 8
708462SApril.Chin@Sun.COM 	return signbit(value);
718462SApril.Chin@Sun.COM #endif
724887Schin }
73