
/*
    Copyright (C) 1993  Claus Vohwinkel

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License , or
    (at your option) any later version.

    This program 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 the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; see the file COPYING.  If not, write to
    the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*/

#pragma force_top_level
#pragma include_only_once
#ifndef __math_h
#include <math.h>
#endif

#ifndef __ymath_h
#define __ymath_h

extern double ysqrt(double);
extern double ypow(double,double);
extern double yexp(double);
extern double ylog10(double);
extern double ylog(double);
extern double yceil(double);
extern double yfloor(double);

#define sqrt(arg1) ysqrt(arg1)
#define hypot(a, b) ysqrt((a)*(a) + (b)*(b))
#define pow(arg1,arg2) ypow(arg1,arg2)
#define exp(arg1) yexp(arg1)
#define log10(arg1) ylog10(arg1)
#define log(arg1) ylog(arg1)
#define ceil(arg1) yceil(arg1)
#define floor(arg1) yfloor(arg1)

# define eq0df(x) (x)
# define z_cutoff(x) ((x)<0.0f ? 0.0f : (x))
# define twotimes(x) ((x)*2.0f)
# define halftimes(x) ((x)*0.5f)
# define timesroot2(x) ((x)*1.41421356237309504882f)
# define divroot2(x)   ((x)*0.70710678118654752441f)
# define ifimul(x, y) ((double)(x)*(double)(y))
# define multwopowx(x, y) ((double)(x) * (double)(2<<(int)(y)))
# define rint(x) \
  ({ double __value, __arg = (x);   \
     asm ("rndd %0, %1": "=f" (__value): "f" (__arg));  \
     __value; })
# define rintftoi(x) \
  ({ int __value; \
     double __arg = (x);   \
     asm ("fix %0, %1": "=r" (__value): "f" (__arg));  \
     __value; })
#endif
