[BACK]Return to interval.h CVS log [TXT][DIR] Up to [local] / OpenXM_contrib2 / asir2000 / include

Diff for /OpenXM_contrib2/asir2000/include/interval.h between version 1.1 and 1.13

version 1.1, 2000/12/22 10:03:29 version 1.13, 2015/08/14 13:51:55
Line 1 
Line 1 
 /*  /*
  * $OpenXM: $   * $OpenXM: OpenXM_contrib2/asir2000/include/interval.h,v 1.12 2015/08/06 10:01:52 fujimoto Exp $
 */  */
 #ifndef _INTERVAL_H  #ifndef _INTERVAL_H
 #define _INTERVAL_H  #define _INTERVAL_H
Line 32  static char *Interval_dummy;
Line 32  static char *Interval_dummy;
   
 #ifdef  linux  #ifdef  linux
 #include        <fpu_control.h>  #include        <fpu_control.h>
   #if 1
   #define LINUX_FPU_RC_MASK                               0xf3ff
   #define LINUX_FPU_SETCW(c)                      \
   {fpu_control_t __tmp__; _FPU_GETCW(__fpu_control);\
    __tmp__ = (__fpu_control & LINUX_FPU_RC_MASK | c);\
    _FPU_SETCW(__tmp__);}
   #define FPNEAREST       LINUX_FPU_SETCW(_FPU_RC_NEAREST);
   #define FPPLUSINF       LINUX_FPU_SETCW(_FPU_RC_UP);
   #define FPMINUSINF      LINUX_FPU_SETCW(_FPU_RC_DOWN);
   #define FPTOZERO                LINUX_FPU_SETCW(_FPU_RC_ZERO);
   #else
 #define _FPU_DEFAULT_p_FPU_RC_UP        0x1b72  #define _FPU_DEFAULT_p_FPU_RC_UP        0x1b72
 #define _FPU_DEFAULT_p_FPU_RC_DOWN      0x1772  #define _FPU_DEFAULT_p_FPU_RC_DOWN      0x1772
 #define _FPU_DEFAULT_p_FPU_RC_ZERO      0x1f72  #define _FPU_DEFAULT_p_FPU_RC_ZERO      0x1f72
Line 40  static char *Interval_dummy;
Line 51  static char *Interval_dummy;
 #define FPMINUSINF      __setfpucw(_FPU_DEFAULT_p_FPU_RC_DOWN);  #define FPMINUSINF      __setfpucw(_FPU_DEFAULT_p_FPU_RC_DOWN);
 #define FPTOZERO        __setfpucw(_FPU_DEFAULT_p_FPU_RC_ZERO);  #define FPTOZERO        __setfpucw(_FPU_DEFAULT_p_FPU_RC_ZERO);
 #endif  #endif
   #endif
   
 #if defined(__osf__)  #if defined(__osf__)
 #if 0  #if 0
Line 56  static char *Interval_dummy;
Line 68  static char *Interval_dummy;
 #endif  #endif
 #endif  #endif
   
 #if defined(__FreeBSD__)  #if defined(__FreeBSD__) && defined(__GNUC__)
 #include        <floatingpoint.h>  #include        <floatingpoint.h>
 #define FPNEAREST       fpsetround(FP_RN);  #define FPNEAREST       fpsetround(FP_RN);
 #define FPPLUSINF       fpsetround(FP_RP);  #define FPPLUSINF       fpsetround(FP_RP);
Line 64  static char *Interval_dummy;
Line 76  static char *Interval_dummy;
 #define FPTOZERO        fpsetround(FP_RZ);  #define FPTOZERO        fpsetround(FP_RZ);
 #endif  #endif
   
   #if defined(VISUAL) || defined(__MINGW32__)
   #include <float.h>
   #define FPNEAREST _controlfp(_RC_NEAR,_MCW_RC);
   #define FPPLUSINF _controlfp(_RC_UP,_MCW_RC);
   #define FPMINUSINF _controlfp(_RC_DOWN,_MCW_RC);
   #define FPTOZERO _controlfp(_RC_CHOP,_MCW_RC);
   #endif
   
 /* no control function of floating point rounding */  /* no control function of floating point rounding */
 #ifndef FPNEAREST  #ifndef FPNEAREST
 #define FPNEAREST       fprintf(stderr, "Fpu control FPNEAREST is not supported in this machine yet.\n");  #define FPNEAREST       fprintf(stderr, "Fpu control FPNEAREST is not supported in this machine yet.\n");
Line 82  static char *Interval_dummy;
Line 102  static char *Interval_dummy;
 #define MID_PRINTF_G    2  #define MID_PRINTF_G    2
 #define MID_PRINTF_E    3  #define MID_PRINTF_E    3
   
 #undef  N_C  
 #undef  N_M  
 #undef  N_LM  
 #undef  N_GF2N  
 #undef  N_GFPN  
 #define N_IP    (N_B+1)  
 #define N_ID    (N_B+2)  
 #define N_IT    (N_B+3)  
 #define N_IF    (N_B+4)  
 #define N_PRE_C N_IF  
 #define N_C     (N_B+5)  
 #define N_M     (N_B+6)  
 #define N_LM    (N_B+7)  
 #define N_GF2N  (N_B+8)  
 #define N_GFPN  (N_B+9)  
   
 /* data structures */  /* data structures */
 struct oItv {  struct oItv {
         short   id;          short   id;
Line 109  struct oItv {
Line 113  struct oItv {
   
 typedef struct oItv *Itv;  typedef struct oItv *Itv;
   
 struct oItvD {  struct oIntervalDouble {
         short   id;          short   id;
         char    nid;          char    nid;
         char    pad;          char    pad;
Line 117  struct oItvD {
Line 121  struct oItvD {
         double  sup;          double  sup;
 };  };
   
 typedef struct oItvD *ItvD;  typedef struct oIntervalDouble *IntervalDouble;
   
 struct oforth {  struct oforth {
         short   sign;          short   sign;
Line 128  struct oforth {
Line 132  struct oforth {
   
 typedef struct oforth *forth;  typedef struct oforth *forth;
   
 struct oItvT {  struct oIntervalQuad {
         short   id;          short   id;
         char    nid;          char    nid;
         char    pad;          char    pad;
Line 136  struct oItvT {
Line 140  struct oItvT {
         forth   sup;          forth   sup;
 };  };
   
 typedef struct oItvT *ItvT;  typedef struct oIntervalQuad *IntervalQuad;
   
 struct oItvF {  struct oIntervalBigFloat {
         short   id;          short   id;
         char    nid;          char    nid;
         char    pad;          char    pad;
Line 146  struct oItvF {
Line 150  struct oItvF {
         BF      sup;          BF      sup;
 };  };
   
 typedef struct oItvF *ItvF;  typedef struct oIntervalBigFloat *IntervalBigFloat;
   
 extern int zerorewrite;  extern int zerorewrite;
   
Line 156  extern int zerorewrite;
Line 160  extern int zerorewrite;
   
 #define NEWItvP(q)      ((q)=(Itv)MALLOC(sizeof(struct oItv)),\  #define NEWItvP(q)      ((q)=(Itv)MALLOC(sizeof(struct oItv)),\
                                         OID(q)=O_N,NID(q)=N_IP)                                          OID(q)=O_N,NID(q)=N_IP)
 #define NEWItvD(q)      ((q)=(ItvD)MALLOC(sizeof(struct oItvD)),\  #define NEWIntervalDouble(q)    ((q)=(IntervalDouble)MALLOC(sizeof(struct oIntervalDouble)),\
                                         OID(q)=O_N,NID(q)=N_ID)                                          OID(q)=O_N,NID(q)=N_IntervalDouble)
 #define NEWItvT(q)      ((q)=(ItvD)MALLOC(sizeof(struct oItvT)),\  #define NEWIntervalQuad(q)      ((q)=(IntervalDouble)MALLOC(sizeof(struct oIntervalQuad)),\
                                         OID(q)=O_N,NID(q)=N_IT)                                          OID(q)=O_N,NID(q)=N_IntervalQuad)
 #define NEWItvF(q)      ((q)=(ItvF)MALLOC(sizeof(struct oItvF)),\  #define NEWIntervalBigFloat(q)  ((q)=(IntervalBigFloat)MALLOC(sizeof(struct oIntervalBigFloat)),\
                                         OID(q)=O_N,NID(q)=N_IF)                                          OID(q)=O_N,NID(q)=N_IntervalBigFloat)
 #define MKItvP(a,b,c)   (NEWItvP(c),(INF(c)=(a),SUP(c)=(b)))  #define MKItvP(a,b,c)   (NEWItvP(c),(INF(c)=(a),SUP(c)=(b)))
 #define MKItvD(a,b,c)   if((zerorewrite) && ((a)<=0.0) && ((b)>=0.0)) (c)=0;\  #define MKIntervalDouble(a,b,c) if((zerorewrite) && ((a)<=0.0) && ((b)>=0.0)) (c)=0;\
                         else (NEWItvD(c),(INF(c)=(a),SUP(c)=(b)))                          else (NEWIntervalDouble(c),(INF(c)=(a),SUP(c)=(b)))
 #define MKItvT(a,b,c)   (NEWItvT(c),(INF(c)=(a),SUP(c)=(b)))  #define MKIntervalQuad(a,b,c)   (NEWIntervalQuad(c),(INF(c)=(a),SUP(c)=(b)))
 #define MKItvF(a,b,c)   (NEWItvF(c),(INF(c)=(a),SUP(c)=(b)))  #define MKIntervalBigFloat(a,b,c)       (NEWIntervalBigFloat(c),(INF(c)=(a),SUP(c)=(b)))
   
 #define ToItvP(a,c)     (NEWItvP(c),INF(c)=(a),SUP(c)=(a))  #define ToItvP(a,c)     (NEWItvP(c),INF(c)=(a),SUP(c)=(a))
 #define ToItvD(a,c)     (NEWItvD(c),INF(c)=(ToReal(a)),SUP(c)=(ToReal(a)))  #define ToIntervalDouble(a,c)   (NEWIntervalDouble(c),INF(c)=(ToReal(a)),SUP(c)=(ToReal(a)))
 #define ToItvF(a,c)     (NEWItvF(c),INF(c)=(a),SUP(c)=(a))  #define ToIntervalBigFloat(a,c) (NEWIntervalBigFloat(c),INF(c)=(a),SUP(c)=(a))
   
 #define ITVP(a) (NID(a)==N_IP)  #define ITVP(a) (NID(a)==N_IP)
 #define ITVD(a) (NID(a)==N_ID)  #define ITVD(a) (NID(a)==N_IntervalDouble)
 #define ITVT(a) (NID(a)==N_IT)  #define ITVQ(a) (NID(a)==N_IntervalQuad)
 #define ITVF(a) (NID(a)==N_IF)  #define ITVF(a) (NID(a)==N_IntervalBigFloat)
   
 /***    engine/itv.c    ***/  /***    engine/itv.c    ***/
 double  ToRealSup(Num);  double  ToRealSup(Num);
Line 224  void    distanceitvp(Itv, Itv, Num *);
Line 228  void    distanceitvp(Itv, Itv, Num *);
 void    ToBf(Num, BF *);  void    ToBf(Num, BF *);
 void    double2bf(double, BF *);  void    double2bf(double, BF *);
 double  bf2double(BF);  double  bf2double(BF);
 void    addulp(ItvF, ItvF *);  void    addulp(IntervalBigFloat, IntervalBigFloat *);
 void    getulp(BF, BF *);  void    getulp(BF, BF *);
   
 void    additvf(ItvF, ItvF, ItvF *);  void    additvf(IntervalBigFloat, IntervalBigFloat, IntervalBigFloat *);
 void    subitvf(ItvF, ItvF, ItvF *);  void    subitvf(IntervalBigFloat, IntervalBigFloat, IntervalBigFloat *);
 void    mulitvf(ItvF, ItvF, ItvF *);  void    mulitvf(IntervalBigFloat, IntervalBigFloat, IntervalBigFloat *);
 void    divitvf(ItvF, ItvF, ItvF *);  void    divitvf(IntervalBigFloat, IntervalBigFloat, IntervalBigFloat *);
 void    chsgnitvf(Itv, Itv *);  void    chsgnitvf(Itv, Itv *);
 int     cmpitvf(Itv, Itv);  int     cmpitvf(Itv, Itv);
 void    pwritvf(Itv, Num, Itv *);  void    pwritvf(Itv, Num, Itv *);
Line 241  double ToRealDown(Num);
Line 245  double ToRealDown(Num);
 double  ToRealUp(Num);  double  ToRealUp(Num);
 void    Num2double(Num, double *, double *);  void    Num2double(Num, double *, double *);
   
 void    additvd(Num, Num, ItvD *);  void    additvd(Num, Num, IntervalDouble *);
 void    subitvd(Num, Num, ItvD *);  void    subitvd(Num, Num, IntervalDouble *);
 void    mulitvd(Num, Num, ItvD *);  void    mulitvd(Num, Num, IntervalDouble *);
 void    divitvd(Num, Num, ItvD *);  void    divitvd(Num, Num, IntervalDouble *);
 void    chsgnitvd(ItvD, ItvD *);  void    chsgnitvd(IntervalDouble, IntervalDouble *);
 int     cmpitvd(ItvD, ItvD);  int     cmpitvd(IntervalDouble, IntervalDouble);
 void    pwritvd(Num, Num, ItvD *);  void    pwritvd(Num, Num, IntervalDouble *);
 void    pwritv0d(ItvD, int, ItvD *);  void    pwritv0d(IntervalDouble, int, IntervalDouble *);
 void    miditvd(ItvD, Num *);  void    miditvd(IntervalDouble, Num *);
 void    cupitvd(ItvD, ItvD, ItvD *);  void    cupitvd(IntervalDouble, IntervalDouble, IntervalDouble *);
 void    capitvd(ItvD, ItvD, ItvD *);  void    capitvd(IntervalDouble, IntervalDouble, IntervalDouble *);
 void    widthitvd(ItvD, Num *);  void    widthitvd(IntervalDouble, Num *);
 void    absitvd(ItvD, Num *);  void    absitvd(IntervalDouble, Num *);
 void    distanceitvd(ItvD, ItvD, Num *);  void    distanceitvd(IntervalDouble, IntervalDouble, Num *);
   
 #endif /* end of INTERVAL */  #endif /* end of INTERVAL */
 #endif /* end of _INTERVAL_H */  #endif /* end of _INTERVAL_H */

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.13

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>