mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
revert error check-in in r11777
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@11779 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
45d282aeb0
commit
0343a11d1a
10 changed files with 804 additions and 402 deletions
|
@ -28,6 +28,7 @@
|
|||
#syck
|
||||
#syslog
|
||||
#tcltklib
|
||||
#thread
|
||||
#tk
|
||||
#win32ole
|
||||
#zlib
|
||||
|
|
|
@ -28,6 +28,7 @@ strscan
|
|||
syck
|
||||
#syslog
|
||||
#tcltklib
|
||||
thread
|
||||
#tk
|
||||
win32ole
|
||||
#zlib
|
||||
|
|
|
@ -224,14 +224,14 @@ GetVpValue(VALUE v, int must)
|
|||
#ifdef ENABLE_NUMERIC_STRING
|
||||
case T_STRING:
|
||||
SafeStringValue(v);
|
||||
return VpCreateRbObject(strlen(RSTRING(v)->ptr) + VpBaseFig() + 1,
|
||||
RSTRING(v)->ptr);
|
||||
return VpCreateRbObject(strlen(RSTRING_PTR(v)) + VpBaseFig() + 1,
|
||||
RSTRING_PTR(v));
|
||||
#endif /* ENABLE_NUMERIC_STRING */
|
||||
|
||||
case T_BIGNUM:
|
||||
bg = rb_big2str(v, 10);
|
||||
return VpCreateRbObject(strlen(RSTRING(bg)->ptr) + VpBaseFig() + 1,
|
||||
RSTRING(bg)->ptr);
|
||||
return VpCreateRbObject(strlen(RSTRING_PTR(bg)) + VpBaseFig() + 1,
|
||||
RSTRING_PTR(bg));
|
||||
default:
|
||||
goto SomeOneMayDoIt;
|
||||
}
|
||||
|
@ -240,7 +240,7 @@ SomeOneMayDoIt:
|
|||
if(must) {
|
||||
rb_raise(rb_eTypeError, "%s can't be coerced into BigDecimal",
|
||||
rb_special_const_p(v)?
|
||||
RSTRING(rb_inspect(v))->ptr:
|
||||
RSTRING_PTR(rb_inspect(v)):
|
||||
rb_obj_classname(v)
|
||||
);
|
||||
}
|
||||
|
@ -332,7 +332,7 @@ BigDecimal_load(VALUE self, VALUE str)
|
|||
unsigned long m=0;
|
||||
|
||||
SafeStringValue(str);
|
||||
pch = RSTRING(str)->ptr;
|
||||
pch = RSTRING_PTR(str);
|
||||
/* First get max prec */
|
||||
while((*pch)!=(unsigned char)'\0' && (ch=*pch++)!=(unsigned char)':') {
|
||||
if(!ISDIGIT(ch)) {
|
||||
|
@ -474,7 +474,7 @@ VpNewRbClass(U_LONG mx, char *str, VALUE klass)
|
|||
}
|
||||
|
||||
VP_EXPORT Real *
|
||||
VpCreateRbObject(U_LONG mx, char *str)
|
||||
VpCreateRbObject(U_LONG mx, const char *str)
|
||||
{
|
||||
Real *pv = VpAlloc(mx,str);
|
||||
pv->obj = (VALUE)Data_Wrap_Struct(rb_cBigDecimal, 0, BigDecimal_delete, pv);
|
||||
|
@ -781,17 +781,6 @@ BigDecimal_eq(VALUE self, VALUE r)
|
|||
return BigDecimalCmp(self, r, '=');
|
||||
}
|
||||
|
||||
/* Returns true if the values are not equal in value. Values may be coerced
|
||||
* to perform the comparison:
|
||||
*
|
||||
* BigDecimal.new('1.0') != 1.0 -> false
|
||||
*/
|
||||
static VALUE
|
||||
BigDecimal_ne(VALUE self, VALUE r)
|
||||
{
|
||||
return BigDecimalCmp(self, r, '!');
|
||||
}
|
||||
|
||||
/* call-seq:
|
||||
* a < b
|
||||
*
|
||||
|
@ -1276,7 +1265,7 @@ BigDecimal_round(int argc, VALUE *argv, VALUE self)
|
|||
{
|
||||
ENTER(5);
|
||||
Real *c, *a;
|
||||
int iLoc;
|
||||
int iLoc = 0;
|
||||
U_LONG mx;
|
||||
VALUE vLoc;
|
||||
VALUE vRound;
|
||||
|
@ -1510,7 +1499,7 @@ BigDecimal_to_s(int argc, VALUE *argv, VALUE self)
|
|||
if(rb_scan_args(argc,argv,"01",&f)==1) {
|
||||
if(TYPE(f)==T_STRING) {
|
||||
SafeStringValue(f);
|
||||
psz = RSTRING(f)->ptr;
|
||||
psz = RSTRING_PTR(f);
|
||||
if(*psz==' ') {
|
||||
fPlus = 1; psz++;
|
||||
} else if(*psz=='+') {
|
||||
|
@ -1687,7 +1676,7 @@ BigDecimal_global_new(int argc, VALUE *argv, VALUE self)
|
|||
mf = GetPositiveInt(nFig);
|
||||
}
|
||||
SafeStringValue(iniValue);
|
||||
GUARD_OBJ(pv,VpCreateRbObject(mf, RSTRING(iniValue)->ptr));
|
||||
GUARD_OBJ(pv,VpCreateRbObject(mf, RSTRING_PTR(iniValue)));
|
||||
return ToValue(pv);
|
||||
}
|
||||
|
||||
|
@ -1718,7 +1707,7 @@ BigDecimal_new(int argc, VALUE *argv, VALUE self)
|
|||
mf = GetPositiveInt(nFig);
|
||||
}
|
||||
SafeStringValue(iniValue);
|
||||
GUARD_OBJ(pv,VpNewRbClass(mf, RSTRING(iniValue)->ptr,self));
|
||||
GUARD_OBJ(pv,VpNewRbClass(mf, RSTRING_PTR(iniValue),self));
|
||||
return ToValue(pv);
|
||||
}
|
||||
|
||||
|
@ -1939,7 +1928,6 @@ Init_bigdecimal(void)
|
|||
rb_define_method(rb_cBigDecimal, "==", BigDecimal_eq, 1);
|
||||
rb_define_method(rb_cBigDecimal, "===", BigDecimal_eq, 1);
|
||||
rb_define_method(rb_cBigDecimal, "eql?", BigDecimal_eq, 1);
|
||||
rb_define_method(rb_cBigDecimal, "!=", BigDecimal_ne, 1);
|
||||
rb_define_method(rb_cBigDecimal, "<", BigDecimal_lt, 1);
|
||||
rb_define_method(rb_cBigDecimal, "<=", BigDecimal_le, 1);
|
||||
rb_define_method(rb_cBigDecimal, ">", BigDecimal_gt, 1);
|
||||
|
@ -2187,7 +2175,7 @@ VpIsNegDoubleZero(double v)
|
|||
}
|
||||
|
||||
VP_EXPORT int
|
||||
VpException(unsigned short f,char *str,int always)
|
||||
VpException(unsigned short f, const char *str,int always)
|
||||
{
|
||||
VALUE exc;
|
||||
int fatal=0;
|
||||
|
@ -2329,7 +2317,7 @@ NaN:
|
|||
* returns number of chars needed to represent vp in specified format.
|
||||
*/
|
||||
VP_EXPORT U_LONG
|
||||
VpNumOfChars(Real *vp,char *pszFmt)
|
||||
VpNumOfChars(Real *vp,const char *pszFmt)
|
||||
{
|
||||
S_INT ex;
|
||||
U_LONG nc;
|
||||
|
@ -2432,7 +2420,7 @@ VpInit(U_LONG BaseVal)
|
|||
}
|
||||
|
||||
VP_EXPORT Real *
|
||||
VpOne()
|
||||
VpOne(void)
|
||||
{
|
||||
return VpConstOne;
|
||||
}
|
||||
|
@ -2482,7 +2470,7 @@ overflow:
|
|||
* NULL be returned if memory allocation is failed,or any error.
|
||||
*/
|
||||
VP_EXPORT Real *
|
||||
VpAlloc(U_LONG mx, char *szVal)
|
||||
VpAlloc(U_LONG mx, const char *szVal)
|
||||
{
|
||||
U_LONG i, ni, ipn, ipf, nf, ipe, ne, nalloc;
|
||||
char v,*psz;
|
||||
|
@ -3897,7 +3885,7 @@ VpToFString(Real *a,char *psz,int fFmt,int fPlus)
|
|||
* ne ... number of characters in exp_chr[],not including '+/-'.
|
||||
*/
|
||||
VP_EXPORT int
|
||||
VpCtoV(Real *a, char *int_chr, U_LONG ni, char *frac, U_LONG nf, char *exp_chr, U_LONG ne)
|
||||
VpCtoV(Real *a, const char *int_chr, U_LONG ni, const char *frac, U_LONG nf, const char *exp_chr, U_LONG ne)
|
||||
{
|
||||
U_LONG i, j, ind_a, ma, mi, me;
|
||||
U_LONG loc;
|
||||
|
|
|
@ -105,7 +105,7 @@ typedef struct {
|
|||
VP_EXPORT Real *
|
||||
VpNewRbClass(U_LONG mx,char *str,VALUE klass);
|
||||
|
||||
VP_EXPORT Real *VpCreateRbObject(U_LONG mx,char *str);
|
||||
VP_EXPORT Real *VpCreateRbObject(U_LONG mx,const char *str);
|
||||
|
||||
VP_EXPORT U_LONG VpBaseFig(void);
|
||||
VP_EXPORT U_LONG VpDblFig(void);
|
||||
|
@ -126,13 +126,13 @@ VP_EXPORT int VpIsRoundMode(unsigned long n);
|
|||
VP_EXPORT unsigned long VpGetRoundMode(void);
|
||||
VP_EXPORT unsigned long VpSetRoundMode(unsigned long n);
|
||||
|
||||
VP_EXPORT int VpException(unsigned short f,char *str,int always);
|
||||
VP_EXPORT int VpException(unsigned short f,const char *str,int always);
|
||||
VP_EXPORT int VpIsNegDoubleZero(double v);
|
||||
VP_EXPORT U_LONG VpNumOfChars(Real *vp,char *pszFmt);
|
||||
VP_EXPORT U_LONG VpNumOfChars(Real *vp,const char *pszFmt);
|
||||
VP_EXPORT U_LONG VpInit(U_LONG BaseVal);
|
||||
VP_EXPORT void *VpMemAlloc(U_LONG mb);
|
||||
VP_EXPORT void VpFree(Real *pv);
|
||||
VP_EXPORT Real *VpAlloc(U_LONG mx, char *szVal);
|
||||
VP_EXPORT Real *VpAlloc(U_LONG mx, const char *szVal);
|
||||
VP_EXPORT int VpAsgn(Real *c,Real *a,int isw);
|
||||
VP_EXPORT int VpAddSub(Real *c,Real *a,Real *b,int operation);
|
||||
VP_EXPORT int VpMult(Real *c,Real *a,Real *b);
|
||||
|
@ -143,7 +143,7 @@ VP_EXPORT void VpSzMantissa(Real *a,char *psz);
|
|||
VP_EXPORT int VpToSpecialString(Real *a,char *psz,int fPlus);
|
||||
VP_EXPORT void VpToString(Real *a,char *psz,int fFmt,int fPlus);
|
||||
VP_EXPORT void VpToFString(Real *a,char *psz,int fFmt,int fPlus);
|
||||
VP_EXPORT int VpCtoV(Real *a,char *int_chr,U_LONG ni,char *frac,U_LONG nf,char *exp_chr,U_LONG ne);
|
||||
VP_EXPORT int VpCtoV(Real *a,const char *int_chr,U_LONG ni,const char *frac,U_LONG nf,const char *exp_chr,U_LONG ne);
|
||||
VP_EXPORT int VpVtoD(double *d,S_LONG *e,Real *m);
|
||||
VP_EXPORT void VpDtoV(Real *m,double d);
|
||||
VP_EXPORT void VpItoV(Real *m,S_INT ival);
|
||||
|
@ -155,7 +155,7 @@ VP_EXPORT void VpFrac(Real *y,Real *x);
|
|||
VP_EXPORT int VpPower(Real *y,Real *x,S_INT n);
|
||||
|
||||
/* VP constants */
|
||||
VP_EXPORT Real *VpOne();
|
||||
VP_EXPORT Real *VpOne(void);
|
||||
|
||||
/*
|
||||
* ------------------
|
||||
|
|
|
@ -379,7 +379,7 @@ after every n digits for readability.
|
|||
<CODE><PRE>
|
||||
BigDecimal("0.1234567890123456789").to_s(10) # ==> "0.1234567890 123456789E0"
|
||||
</PRE></CODE>
|
||||
n can be an string representing a positive integer number.
|
||||
n can be a string representing a positive integer number.
|
||||
<CODE><PRE>
|
||||
BigDecimal("0.1234567890123456789").to_s("10") # ==> "0.1234567890 123456789E0"
|
||||
</PRE></CODE>
|
||||
|
@ -678,10 +678,9 @@ structure.
|
|||
</DL>
|
||||
|
||||
<H3>Disadvantage of decimal representation</H3>
|
||||
Advantages stated so far can also be disadvantages if the input from outside is
|
||||
represented in binary.
|
||||
Translation error from decimal to binary or vice versa is inevitable.
|
||||
So,translation from Float(binary) to BigDecimal(decimal) is not alway done exactly.
|
||||
Because most computers have no internal decimal representaion.
|
||||
Once you use BigDecimal,you need to keep using it without
|
||||
considering computation cost if exact computation is required.
|
||||
|
||||
<H4>Which is the first input?</H4>
|
||||
Because most people uses decimal notatin for numeric data representation,
|
||||
|
|
|
@ -676,10 +676,11 @@ exponent=1
|
|||
|
||||
<H3>10進のデメリット</H3>
|
||||
実は今までのメリットは、そのままデメリットにもなります。
|
||||
そもそも、10進を2進、2進を10進に変換するような操作は変換誤差
|
||||
そもそも、10進を2進に変換するような操作は変換誤差
|
||||
を伴う場合を回避することはできません。
|
||||
既に計算機内部に取り込まれた2進数値を BigDecimal の内部表現に
|
||||
変換するときには誤差が避けられない場合があります。
|
||||
大概のコンピュータは10進の内部表現を持っていないので、
|
||||
BigDecimal を利用して誤差無しの計算をする場合は、計算速度
|
||||
を無視しても最後まで BigDecimal を使用続ける必要があります。
|
||||
|
||||
<H3>最初は何か?</H3>
|
||||
自分で計算するときにわざわざ2進数を使う人は極めてまれです。
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -7544,7 +7544,7 @@ const unsigned short cp932inv[2][189] = {
|
|||
0xFBFC, 0xFC40, 0xFC41, 0xFC42, 0xFC43, 0xFC44, 0xFC45, 0xFC46,
|
||||
0xFC47, 0xFC48, 0xFC49, 0xFC4A, 0xFC4B, 0, 0, 0xFA40,
|
||||
0xFA41, 0xFA42, 0xFA43, 0xFA44, 0xFA45, 0xFA46, 0xFA47, 0xFA48,
|
||||
0xFA49, 0, 0xFA55, 0xFA56, 0xFA57,
|
||||
0xFA49, 0x81CA, 0xFA55, 0xFA56, 0xFA57,
|
||||
},
|
||||
};
|
||||
#endif /* SHIFTJIS_CP932 */
|
||||
|
|
|
@ -707,7 +707,7 @@ squelching curiosity."
|
|||
- <A HREF="http://linuxtoday.com/story.php3?sn=15876"><FONT COLOR="#000000">Kernel Cousin gimp-devel #11 Is Out</FONT></A><BR>
|
||||
- <A HREF="http://linuxtoday.com/story.php3?sn=15875"><FONT COLOR="#000000">Infoworld: Corel Linux OS ideal for the desktop</FONT></A><BR>
|
||||
- <A HREF="http://linuxtoday.com/story.php3?sn=15874"><FONT COLOR="#000000">Technology Evaluation: IBM Jumps on the Linux Bandwagon with Both Feet, Sort Of</FONT></A><BR>
|
||||
- <A HREF="http://linuxtoday.com/story.php3?sn=15873"><FONT COLOR="#000000">Tobias Hövekamp: European Union acknowledges</FONT></A><BR>
|
||||
- <A HREF="http://linuxtoday.com/story.php3?sn=15873"><FONT COLOR="#000000">Tobias Hövekamp: European Union acknowledges</FONT></A><BR>
|
||||
- <A HREF=""><FONT COLOR="#000000">&</FONT></A><BR>
|
||||
- <A HREF=""><FONT COLOR="#000000">#34;Open Source Software</FONT></A><BR>
|
||||
- <A HREF=""><FONT COLOR="#000000">&</FONT></A><BR>
|
||||
|
@ -757,7 +757,7 @@ squelching curiosity."
|
|||
<TR BGCOLOR="#000000"><TD><IMG SRC="image4" WIDTH="1" HEIGHT="2" ALT=""></TD></TR></TABLE>
|
||||
</CENTER>
|
||||
<TABLE CELLSPACING="0" CELLPADDING="2" WIDTH="100%" BORDER="0"><TR>
|
||||
<TD VALIGN="top" ALIGN="center"><FONT FACE="Lucida,Verdana,Helvetica,Arial"><SMALL>copyright © 1997-2000 <A HREF="http://andover.net">Andover.Net</A> -
|
||||
<TD VALIGN="top" ALIGN="center"><FONT FACE="Lucida,Verdana,Helvetica,Arial"><SMALL>copyright © 1997-2000 <A HREF="http://andover.net">Andover.Net</A> -
|
||||
icons courtesy of <A HREF="mailto:tigert@gimp.org">tigert@gimp.org</A> -
|
||||
code revision <A HREF="http://freshmeat.net/ChangeLog">20000101</A> -
|
||||
our <A HREF="http://www.andover.net/privacy.html">privacy policy</A></SMALL></FONT></TD>
|
||||
|
|
|
@ -79,7 +79,7 @@
|
|||
|
||||
#define WC2VSTR(x) ole_wc2vstr((x), TRUE)
|
||||
|
||||
#define WIN32OLE_VERSION "0.7.0"
|
||||
#define WIN32OLE_VERSION "0.7.1"
|
||||
|
||||
typedef HRESULT (STDAPICALLTYPE FNCOCREATEINSTANCEEX)
|
||||
(REFCLSID, IUnknown*, DWORD, COSERVERINFO*, DWORD, MULTI_QI*);
|
||||
|
@ -921,8 +921,13 @@ ole_variant2val(pvar)
|
|||
VARIANT variant;
|
||||
VALUE val;
|
||||
VALUE val2;
|
||||
int dim = 0;
|
||||
|
||||
if (!psa) {
|
||||
return obj;
|
||||
}
|
||||
dim = SafeArrayGetDim(psa);
|
||||
|
||||
int dim = SafeArrayGetDim(psa);
|
||||
VariantInit(&variant);
|
||||
V_VT(&variant) = (V_VT(pvar) & ~VT_ARRAY) | VT_BYREF;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue