1 << 2.71

1 e$B$re(B 2.71 bit e$B$[$I:8%7%U%H$9$k$He(B 4
e$B$K$J$k$h$&$G$9$,!"$3$l$Oe(B
e$B0U?^$5$l$?7k2L$G$7$g$&$+!#e(B

% ./ruby -ve ‘p 1 << 2.71’
ruby 1.9.0 (2008-05-20 revision 16494) [i686-linux]
4

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

In message “Re: [ruby-dev:34776] 1 << 2.71”
on Wed, 21 May 2008 00:43:52 +0900, Tanaka A. [email protected]
writes:

|1 e$B$re(B 2.71 bit e$B$[$I:8%7%U%H$9$k$He(B 4 e$B$K$J$k$h$&$G$9$,!"$3$l$Oe(B
|e$B0U?^$5$l$?7k2L$G$7$g$&$+!#e(B

e$B$O$$!#$=$N0U?^$=$N$b$N$r8!F$Cf$G$O$"$j$^$9$,!#e(B
e$B$A$J$_$Ke(BPerle$B$b$=$&$G$9$M!#e(B

perl -le ‘print 1<<2.71’
4

In article [email protected],
Yukihiro M. [email protected] writes:

e$B$O$$!#$=$N0U?^$=$N$b$N$r8!F$Cf$G$O$"$j$^$9$,!#e(B
e$B$A$J$_$Ke(BPerle$B$b$=$&$G$9$M!#e(B

perl -le ‘print 1<<2.71’
4

e$B$A$J$_$Ke(B C e$B$He(B Python e$B$He(B Gauche
e$B$G$O%(%i!<$G$9$M!#e(B

% cat t.c
int main(int argc, char **argv)
{
1 << 2.71;
return 0;
}
nute(11:57:06)% gcc t.c
t.c: In function ‘main’:
t.c:3: error: invalid operands to binary <<

% python
Python 2.4.4 (#2, Apr 15 2008, 23:43:20)
[GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)] on linux2
Type “help”, “copyright”, “credits” or “license” for more information.

1 << 2.71
Traceback (most recent call last):
File “”, line 1, in ?
TypeError: unsupported operand type(s) for <<: ‘int’ and ‘float’

% gosh
gosh> (ash 1 2.71)
*** ERROR: small integer required, but got 2.71
Stack Trace:

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs