From 97caa971ba3d7f11ff608f7a333f098c0d2a0a8c Mon Sep 17 00:00:00 2001 From: Chris Xiong Date: Tue, 6 Oct 2015 11:27:15 +0800 Subject: Forgot to add '-a'... --- src/core/scriptshared.hpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/core/scriptshared.hpp') diff --git a/src/core/scriptshared.hpp b/src/core/scriptshared.hpp index 01d423a..65c02bc 100644 --- a/src/core/scriptshared.hpp +++ b/src/core/scriptshared.hpp @@ -3,28 +3,28 @@ #include #define eps 1e-6 typedef union _Udata{//data union - int i;float r;unsigned long d; + int i;double r;unsigned long d; _Udata(){d=0;} }Udata; typedef struct _Idata{//data union, with type tag and operators _Udata D; - int type;//0=int, 1=float + int type;//0=int, 1=double _Idata(){D.d=0;type=0;} _Idata(int _type,int _data) - {type=_type;if(type==0)D.i=_data;else D.r=(float)_data;} - float &r(){return D.r;} + {type=_type;if(type==0)D.i=_data;else D.r=(double)_data;} + double &r(){return D.r;} int &i(){return D.i;} unsigned long &d(){return D.d;} _Idata operator =(_Idata r) { - if(type==1&&r.type==0)this->r()=(float)r.i(); + if(type==1&&r.type==0)this->r()=(double)r.i(); else if(type==0&&r.type==1)this->i()=(int)r.r(); else this->d()=r.d(); return *this; } _Idata operator +=(_Idata r) { - if(type==1&&r.type==0)this->r()+=(float)r.i(); + if(type==1&&r.type==0)this->r()+=(double)r.i(); if(type==0&&r.type==1)this->i()+=(int)r.r(); if(type==0&&r.type==0)this->i()+=r.i(); if(type==1&&r.type==1)this->r()+=r.r(); @@ -32,7 +32,7 @@ typedef struct _Idata{//data union, with type tag and operators } _Idata operator -=(_Idata r) { - if(type==1&&r.type==0)this->r()-=(float)r.i(); + if(type==1&&r.type==0)this->r()-=(double)r.i(); if(type==0&&r.type==1)this->i()-=(int)r.r(); if(type==0&&r.type==0)this->i()-=r.i(); if(type==1&&r.type==1)this->r()-=r.r(); @@ -40,7 +40,7 @@ typedef struct _Idata{//data union, with type tag and operators } _Idata operator *=(_Idata r) { - if(type==1&&r.type==0)this->r()*=(float)r.i(); + if(type==1&&r.type==0)this->r()*=(double)r.i(); if(type==0&&r.type==1)this->i()*=(int)r.r(); if(type==0&&r.type==0)this->i()*=r.i(); if(type==1&&r.type==1)this->r()*=r.r(); @@ -48,7 +48,7 @@ typedef struct _Idata{//data union, with type tag and operators } _Idata operator /=(_Idata r) { - if(type==1&&r.type==0)this->r()/=(float)r.i(); + if(type==1&&r.type==0)this->r()/=(double)r.i(); if(type==0&&r.type==1)this->i()/=(int)r.r(); if(type==0&&r.type==0)this->i()/=r.i(); if(type==1&&r.type==1)this->r()/=r.r(); -- cgit v1.2.3