Mail Archives: djgpp/2009/10/05/04:31:27
X-Authentication-Warning: | delorie.com: mail set sender to djgpp-bounces using -f
|
From: | Rugxulo <rugxulo AT gmail DOT com>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Re: Ruby 1.8.7 (pl174) "make test" fails (floating point) *only* with
|
| default CFLAGS -O2
|
Date: | Mon, 5 Oct 2009 01:26:57 -0700 (PDT)
|
Organization: | http://groups.google.com
|
Lines: | 116
|
Message-ID: | <65a0ba18-c3ed-42e9-92ed-78ed7c94f5a0@v20g2000vbs.googlegroups.com>
|
References: | <7ac90bf8-5f37-466d-b531-211b75874bab AT a6g2000vbp DOT googlegroups DOT com>
|
NNTP-Posting-Host: | 65.13.115.246
|
Mime-Version: | 1.0
|
X-Trace: | posting.google.com 1254731217 21715 127.0.0.1 (5 Oct 2009 08:26:57 GMT)
|
X-Complaints-To: | groups-abuse AT google DOT com
|
NNTP-Posting-Date: | Mon, 5 Oct 2009 08:26:57 +0000 (UTC)
|
Complaints-To: | groups-abuse AT google DOT com
|
Injection-Info: | v20g2000vbs.googlegroups.com; posting-host=65.13.115.246;
|
| posting-account=p5rsXQoAAAB8KPnVlgg9E_vlm2dvVhfO
|
User-Agent: | G2/1.0
|
X-HTTP-UserAgent: | Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US)
|
| AppleWebKit/532.0 (KHTML, like Gecko) Chrome/3.0.195.24 Safari/532.0,gzip(gfe),gzip(gfe)
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Reply-To: | djgpp AT delorie DOT com
|
Hi,
On Sep 27, 2:40=A0pm, Rugxulo <rugx DOT DOT DOT AT gmail DOT com> wrote:
> =A0 =A0I've never written anything in Ruby, but I did for laughs download
> latest 1.8.7 source (from 12 June 2009) since 1.9.x doesn't support
> DJGPP any more (for various reasons, esp. no maintainer). Mainly I was
> just wanting to test still more Befunge93 interpreters (since I
> discovered that language recently, heh). =A0 =A0 ;-)
Now I'm on an ETA kick. It's another esoteric language, only eight
commands, but it's quite different from Brainf***.
http://www.miketaylor.org.uk/tech/eta/doc/
http://www.frox25.no-ip.org/~mtve/code/eso/eta/
http://www.stephensykes.com/
There's even an ETA interpreter written by mtve in Befunge, but it
seems to only work with the official C interpreter. Sykes' tiny ETA
interpreter in Ruby is only four lines (224 bytes). ;-)
Anyways, long story short, here's some simple and lame Ruby code:
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
[ Vista ] - Mon 10/05/2009 >cat file2eta.rb
#!/usr/bin/ruby
f =3D File.open ARGV[0] || "to_eta.txt"
f.each_byte do
|number| if number !=3D 10 then
number7 =3D []
etanum =3D number
until etanum =3D=3D 0 do
quotient =3D etanum / 7; remainder =3D etanum % 7; etanum /=3D 7;
number7.unshift(remainder)
end
print "#{number7.to_s.tr('0123456','HTAOINS')} "
end
end
[ Vista ] - Mon 10/05/2009 >cat testfile.txt
HI DJGPP
[ Vista ] - Mon 10/05/2009 >ruby file2eta.rb testfile.txt
TOA TOO II TAN TOI TOT TIO TIO
[ Vista ] - Mon 10/05/2009 >scrndump
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
And after some toying with it, here's my cleaned up version:
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
UNTO ALL EONZ TO DO, YEOM4NZ LIMP ICE ONT0P ANY LEOP4RD APATHETIC
FUN TOYZ FILE ONTO TEFLON TIPZ OF BERRY POPZ UNTIL OFFER3D BLOBZ
PAUL BLART IZ WONT TO PROCLAIM LOVE UNTO THINE GNU CC
(fr0m GNU telnet)
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
:-)
No, it doesn't have to be all uppercase, and some of that is spurious
comments anyways (for "readability", heh).
I also wrote a silly base7 converter in Ruby:
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
#!/usr/bin/ruby
=3Dbegin
My first Ruby program !! Do whatever you want, "nenies proprajxo".
converts a base7 number to/from decimal for help with ETA programs
=3Dend
puts "Please enter a number: "; number =3D gets.chomp
if number.to_i =3D=3D 0 then
number.gsub!(/[^hHtTaAoOiInNsS]/,'')
etanum =3D number.upcase.tr('HTAOINS','0123456')
print "#{etanum} \"#{number.upcase}\" to decimal" + \
" is #{etanum.to_i(7)}\n"
else
number7 =3D []
etanum =3D number.to_i
until etanum =3D=3D 0 do
quotient =3D etanum / 7; remainder =3D etanum % 7; etanum /=3D 7;
number7.unshift(remainder);
end
print "#{number} \"#{number.tr('0123456','HTAOINS')}\" to " \
+ "decimal is #{number.to_i(7)} or from base7 is #{number7} " \
+ "\"#{number7.to_s.tr('0123456','HTAOINS')}\"\n"
#print `echo #{number} | sed -e "y/0123456/HTAOINS/"`
end
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
... which produces this:
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
[ Vista ] - Mon 10/05/2009 >miniruby base7.rb
Please enter a number:
tan
125 "TAN" to decimal is 68
[ Vista ] - Mon 10/05/2009 >miniruby base7.rb
Please enter a number:
toi
134 "TOI" to decimal is 74
[ Vista ] - Mon 10/05/2009 >ruby -e "str=3D[68,74]; print str[0].chr,str
[1].chr"
DJ
[ Vista ] - Mon 10/05/2009 >scrndump
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
- Raw text -