e$BLZB<$G$9!#e(B
e$BKhEY%S%k%I$,$G$-$J$$$H$$$&Ej9F$P$+$j$G?=$7Lu$J$$$G$9$,e(B
cl -nologo main.obj dmydln.obj prelude.obj array.obj
(e$BN,e(B)
numeric.obj : error LNK2019: e$BL$2r7h$N30It%7%s%%ke(B _round
e$B$,4X?te(B
_flo_divmod e$B$G;2>H$5$l$^$7$?!#e(B
miniruby.exe : fatal error LNK1120: e$B30It;2>He(B 1
e$B$,L$2r7h$G$9!#e(B
NMAKE : fatal error U1077: ‘cl’ : e$B%j%?!<%se(B e$B%3!<%Ie(B ‘0x2’
Stop.
round e$B$Oe(B C99e$B$GDI2C$5$l$?4X?t$_$?$$$G$9$M!#e(B
e$B$G!"e(BVC71 e$B$K$O$J$$$H!#e(B
#round e$B$H$$$&7A$G$b;}$C$F$$$J$$$$?$$$G$9!#e(B
e$B$$$C$H!#e(B
KIMURA Koichi wrote:
round e$B$Oe(B C99e$B$GDI2C$5$l$?4X?t$_$?$$$G$9$M!#e(B
e$B$G!"e(BVC71 e$B$K$O$J$$$H!#e(B
#round e$B$H$$$&7A$G$b;}$C$F$$$J$$$$?$$$G$9!#e(B
e$B2DG=@-$H$7$F$O$3$l$/$i$$e(B?
- rounde$B;H$o$J$$!#e(B
- missing/round.ce$B$r:n$k!#e(Bconfiguree$B$GB8:_@-$r3NG’$9$k!#e(B
- Float#rounde$B$O$"$k$s$@$+$i$=$l$r;H$&e(B
Index: numeric.c
— numeric.c (revision 13902)
+++ numeric.c (working copy)
@@ -715,8 +715,7 @@
}
flodivmod(RFLOAT(x)->value, fy, &div, &mod);
if (FIXABLE(div)) {
-
val = round(div);
-
a = LONG2FIX(val);
e$BLZB<$G$9!#e(B
On Nov 13, 2007 6:04 PM, Urabe S. [email protected] wrote:
- missing/round.ce$B$r:n$k!#e(Bconfiguree$B$GB8:_@-$r3NG’$9$k!#e(B
- Float#rounde$B$O$"$k$s$@$+$i$=$l$r;H$&e(B
rev 13907 e$B$G!"e(Bifdefe$B$r@Z$C$Fe(Brounde$B$,$J$$>l9g$K$Oe(B
val = (div < 0) ? ceil(x - 0.5) : floor(x + 0.5);
e$B$N$h$&$K$9$k=$@5$,F~$C$F$$$^$9$,$I$s$J$b$s$G$7$g$&$+!#e(B
Google code search e$B$G$_$D$1$?e(B round
e$B$N<BAu$@$H!“%$%s%i%$%s%”%;%s%V%i$be(B
e$B;H$C$F$^$7$?!#e(B
e$B$"$He(B round e$B$N@53N$J;EMM$rCN$i$J$$$N$G$9$,!“4]$aJ}<0$Ke(B
banker’s rounding e$B$r;H$C$F$$$k$H$9$k$H>e$N%3!<%I$H0c$$$,$G$k>l9g$,e(B
e$B$”$j$&$k$h$&$J5$$,$7$^$9!#e(B
e$BLZB<$G$9!#e(B
On Nov 13, 2007 10:51 PM, Nobuyoshi N. [email protected] wrote:
e$B@bL@e(B
e$B$3$l$i$N4X?t$Oe(B x e$B$r:G$b6a$$@0?tCM$K4]$a$k!#e(B 2 e$B$D$N@0?t$Ne(B
e$BCf4VCM$N>l9g$O!"e(B rint() e$B$N$h$&$K:G$b6a$$6v?t$K4]$a$?$j$;e(B
e$B$:$K!"e(B (e$B8=:_$N4]$aJ}8~$K4X78$J$/e(B) 0 e$B$+$i1s$$J}$K4]$a$k!#e(B
e$B$“!”:G6aCM4]$a$J$N$G$9$M!#e(B
e$BG<F@$7$^$7$?!#e(B
e$B$J$+$@$G$9!#e(B
At Tue, 13 Nov 2007 22:27:03 +0900,
e$B$-$`$i$3$&$$$Ae(B wrote in [ruby-dev:32262]:
e$B$"$He(B round e$B$N@53N$J;EMM$rCN$i$J$$$N$G$9$,!“4]$aJ}<0$Ke(B
banker’s rounding e$B$r;H$C$F$$$k$H$9$k$H>e$N%3!<%I$H0c$$$,$G$k>l9g$,e(B
e$B$”$j$&$k$h$&$J5$$,$7$^$9!#e(B
round()e$B$Oe(BC99e$B$GDj5A$5$l$F$$$^$9!#e(B
$ man round
e$BL>A0e(B
round, roundf, roundl - e$B:G$b6a$$@0?tC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$N$b$“$j$@$H$O;W$$$^$9!#%7%9%F%`$,Ds6!$9$ke(Bround()e$B$,$”$l$P!"$?$H$($Pe(B
doublee$B$h$j$b9b@:EY$J1i;;$H$+$r$7$F$/$l$k$+$b$7$l$^$;$s!#E57?E*$K$Oe(Bx86e$B$Ge(B
80bite$B1i;;$7$F$/$l$k$H$+!#e(B
Google code search e$B$G$_$D$1$?e(B round e$B$N<BAu$@$H!“%$%s%i%$%s%”%;%s%V%i$be(B
e$B;H$C$F$^$7$?!#e(B
e$B$C$F$$$&$N$O$=$&$$$&$H$3$m$r0U?^$7$F$k$H$+$8$c$J$$$G$9$+$M!#e(B
From: Nobuyoshi N. [email protected]
Date: Tue, 13 Nov 2007 22:51:25 +0900
Message-Id: [email protected]
/~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
At Tue, 13 Nov 2007 22:27:03 +0900,
e$B$-$`$i$3$&$$$Ae(B wrote in [ruby-dev:32262]:
e$B$"$He(B round e$B$N@53N$J;EMM$rCN$i$J$$$N$G$9$,!“4]$aJ}<0$Ke(B
banker’s rounding e$B$r;H$C$F$$$k$H$9$k$H>e$N%3!<%I$H0c$$$,$G$k>l9g$,e(B
e$B$”$j$&$k$h$&$J5$$,$7$^$9!#e(B
round()e$B$Oe(BC99e$B$GDj5A$5$l$F$$$^$9!#e(B
Ce$B8@8l$NOC$J$N$+$I$&$+$o$+$j$^$;$s$,!“0J2<$N$h$&$JOC$,$”$j$^$9!#e(B
e$BC<?t=hM}e(B - Wikipedia:
e$BB?$/$N4D6-$Ke(Brounde$B$H$$$&4X?t$,$"$k$,!"4D6-$K$h$C$FF0:n$,0[$J$k$N$G!“e(B
e$B;HMQ$K$OCm0U$,I,MW$G$”$k!#e(B
-
#if !defined(HAVE_ROUND) || !(defined(STDC_VERSION) &&
STDC_VERSION >= 199900L)
e$BEy$H$9$k$N$O!">iD9$G$7$g$&$+!#e(B
e$B$J$+$@$G$9!#e(B
At Wed, 14 Nov 2007 10:03:01 +0900,
pegacorn wrote in [ruby-dev:32284]:
Ce$B8@8l$NOC$J$N$+$I$&$+$o$+$j$^$;$s$,!“0J2<$N$h$&$JOC$,$”$j$^$9!#e(B
e$BC<?t=hM}e(B - Wikipedia:
端数処理 - Wikipedia
e$BB?$/$N4D6-$Ke(Brounde$B$H$$$&4X?t$,$"$k$,!"4D6-$K$h$C$FF0:n$,0[$J$k$N$G!“e(B
e$B;HMQ$K$OCm0U$,I,MW$G$”$k!#e(B
modf()e$B$N$[$&$,$$$$$G$9$+$M$'!#e(B
Index: numeric.c
— numeric.c (revision 13918)
+++ numeric.c (working copy)
@@ -70,11 +70,10 @@ round(double x)
double f;
- if (x > 0.0) {
- f = floor(x);
- x = f + (x - f >= 0.5);
- }
- else if (x < 0.0) {
- f = ceil(x);
- x = f - (f - x >= 0.5);
- f = modf(x, &x);
- if (f >= 0.5) {
- x += 1.0;
- }
- else if (f <= -0.5) {
- x -= 1.0;
}
return x;