/*------------------------->  Sather - configfile  <-------------------------*/
/* Copyright (C) 2000 by K Hopper, University of Waikato, New Zealand        */
/* This file is part of the GNU Sather library. It is free software; you may */
/* redistribute  and/or modify it under the terms of the GNU Library General */
/* Public  License (LGPL)  as published  by the  Free  Software  Foundation; */
/* either version 2 of the license, or (at your option) any later version.   */
/* This  library  is distributed  in the  hope that it will  be  useful, but */
/* WITHOUT ANY WARRANTY without even the implied warranty of MERCHANTABILITY */
/* or FITNESS FOR A PARTICULAR PURPOSE. See Doc/LGPL for more details.       */
/* The license text is also available from:  Free Software Foundation, Inc., */
/* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA                     */
/*------------>  Please email comments to <bug-sather@gnu.org>  <------------*/

#ifndef FLTD_CONFIG
#define FLTD_CONFIG

#ifdef PP
#undef PP
#endif

#ifdef APP
#undef APP
#endif

#ifdef FPP
#undef FPP
#endif

#ifdef VSTD
#undef VSTD
#endif

#ifdef IM
#undef IM
#endif

#define PP	no_pre,no_post
#define APP	arith,PP
#define FPP	fragile,PP
#define VSTD    var "@r $$;"
#define IM	declare "#include <math.h>"

--   NOTE The following definitions assume that all floating point operations
--        return NaN if used with wrong arguments (a la IEEE). If this is not
--        the case for some machines, all functions that could break should be
--        made 'fragile'.

FLTD_PI:		PP,VSTD,IM,exec "$$=M_PI;" "$$";
FLTD_E:			PP,VSTD,IM,exec "$$=M_E;" "$$";
FLTD_SQRT_2:		PP,VSTD,IM,exec "$$=M_SQRT2;" "$$";
FLTD_HALF_PI:		PP,VSTD,IM,exec "$$=M_PI_2;" "$$";
FLTD_QUARTER_PI:	PP,VSTD,IM,exec "$$=M_PI_4;" "$$";
FLTD_INV_SQRT_2:	PP,VSTD,IM,exec "$$=M_SQRT1_2;" "$$";
FLTD_INV_PI:		PP,VSTD,IM,exec "$$=M_1_PI;" "$$";
FLTD_DOUBLE_INV_PI:	PP,VSTD,IM,exec "$$=M_2_PI;" "$$";
FLTD_DOUBLE_SQRT_PI:	PP,VSTD,IM,exec "$$=M_2_SQRTPI;" "$$";

FLTD_QUIET_NAN:		PP,VSTD,IM,exec "$$=quiet_nan($1);" "$$";
FLTD_SIGNALLING_NAN:	PP,VSTD,IM,exec "$$=signaling_nan($1);" "$$";
FLTD_INFINITY:		PP,VSTD,IM,exec "$$=(FLTD)infinity();" "$$";

FLTD_MIN_NORMAL:	PP,VSTD,IM,exec "$$=FLTDMINNORMAL;" "$$";
FLTD_MAX_NORMAL:	PP,VSTD,IM,exec "$$=FLTDMAXNORMAL;" "$$";
FLTD_MIN_SUBNORMAL:	PP,VSTD,IM,exec "$$=FLTDMINSUBNORMAL;" "$$";
FLTD_MAX_SUBNORMAL:	PP,VSTD,IM,exec "$$=FLTDMINSUBNORMAL;" "$$";

FLTD_CARD:              PP,VSTD,exec "$$=FLTDCARD($0);" "$$";
FLTD_FIELD:             PP,VSTD,exec "$$=FLTDFIELD($0);" "$$";
FLTD_INT:		PP,VSTD,exec "$$=FLTDINT($0);" "$$";
FLTD_FLT:		PP,VSTD,exec "$$=(FLT)$0;" "$$";

FLTD_PLUS:		PP,VSTD,exec "$$=$0+$1;" "$$";
FLTD_MINUS:		PP,VSTD,exec "$$=$0-$1;" "$$";
FLTD_NEGATE:		PP,VSTD,exec "$$= -$0;" "$$";
FLTD_TIMES:		PP,VSTD,exec "$$=$0*$1;" "$$";
FLTD_DIV:		PP,VSTD,exec "$$=FLTDDIV($0,$1);" "$$";

FLTD_IS_EQ:		PP,VSTD,exec "$$=($0)==($1);" "$$";
FLTD_IS_LT:		PP,VSTD,exec "$$=($0)<($1);" "$$";
FLTD_ISNORMAL:		PP,VSTD,IM,exec "$$=isnormal($0)!=0;" "$$";
FLTD_ISSUBNORMAL:	PP,VSTD,IM,exec "$$=issubnormal($0)!=0;" "$$";
FLTD_ISZERO:		PP,VSTD,IM,exec "$$=iszero($0)!=0;" "$$";

FLTD_SIGNBIT:		PP,VSTD,IM,exec "$$=signbit($0);" "$$";
FLTD_FINITE:		PP,VSTD,IM,exec "$$=finite($0)!=0;" "$$";
FLTD_ISINF:		PP,VSTD,IM,exec "$$=isinf($0)!=0;" "$$";
FLTD_ILOGB:		PP,VSTD,IM,exec "$$=ilogb($0);" "$$";
FLTD_COPYSIGN:		PP,VSTD,IM,exec "$$=copysign($0);" "$$";
FLTD_NEXTUP:		PP,VSTD,IM,exec "$$=nextafter($0,1.0d);" "$$";
FLTD_NEXTDOWN:		PP,VSTD,IM,exec "$$=nextafter($0,-1.0d);" "$$";
FLTD_SCALBN:		PP,VSTD,IM,exec "$$=scalbn($0);" "$$";
FLTD_GET_REP:		PP,exec "rt_fltd_get_rep($0,$1,$2,$3,$4);";
FLTD_TRUNCATE:		PP,VSTD,IM,exec "$$=FLTDTRUNCATE($0);" "$$";
FLTD_FLOOR:		PP,VSTD,IM,exec "$$=floor($0);" "$$";
FLTD_CEIL:		PP,VSTD,IM,exec "$$=ceil($0);" "$$";
FLTD_ROUND:		PP,VSTD,IM,exec "$$=FLTDROUND($0);" "$$";
FLTD_REMAINDER:		PP,VSTD,IM,exec "$$=remainder($0);" "$$";
FLTD_FMOD:		PP,VSTD,IM,exec "$$=fmod($0);" "$$";
FLTD_FABS:		PP,VSTD,IM,exec "$$=fabs($0);" "$$";
FLTD_SQRT:		PP,VSTD,IM,exec "$$=sqrt($0);" "$$";
FLTD_CBRT:		PP,VSTD,IM,exec "$$=cbrt($0);" "$$";

#endif
