Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Unintentional hype of Ruby irb and ri

Reply
Thread Tools

Unintentional hype of Ruby irb and ri

 
 
Thomas E Enebo
Guest
Posts: n/a
 
      03-31-2006
On Fri, 31 Mar 2006, Ryan Allen defenestrated me:
> Hi Guys (and Gals!)
>
> This is my first post on the list, so Hello!
>
> Something very strange is happening (as far as I can tell) with a
> float comparison; here is the code in question:
>
> ("55.59".to_f / 100) == 0.5559 # returns false
>
>
> It doesn't seem to like .59's... What did .59 ever do?
>
> I picked this up while writing a unit test, I've run this code in irb
> and I'm not sure what's going on...
>
> Can anyone shed some light on this?


Looking at some IEEE spec will explain this in agonizing detail, but
simply stated numbers in a computer are stored in a base 2 format. The
math you are doing is base 10. Not all base 10 values can be perfectly
represented in base 2. This can cause calculations to not quite come
out right.

A book on numerical analysis can also be a good intro on this stuff.

-Tom

--
+ http://www.tc.umn.edu/~enebo +---- private.php?do=newpm&u= ----+
| Thomas E Enebo, Protagonist | "Luck favors the prepared |
| | mind." -Louis Pasteur |


 
Reply With Quote
 
 
 
 
Ryan Allen
Guest
Posts: n/a
 
      03-31-2006
Thank you for the replies!

I should have searched the list first before asking!

Ryan.


 
Reply With Quote
 
 
 
 
listrecv@gmail.com
Guest
Posts: n/a
 
      03-31-2006
Just to corroborate: I actually do prefer RHEL distros, but the Ruby
RPM's should be avoided.

 
Reply With Quote
 
Randy Kramer
Guest
Posts: n/a
 
      03-31-2006
On Thursday 30 March 2006 05:21 pm, wrote:
> On Fri, 31 Mar 2006, Randy Kramer wrote:
> > On Thursday 30 March 2006 12:59 pm, wrote:

> if you follow these steps just about anything will work:
>
> - chose a common nfs location. we'll call it /nfs
>
> - every single time you compile something do this
>
> export LD_RUN_PATH=/nfs/lib
> export LD_LIBRARY_PATH=/nfs/lib
> ./configure --prefix=/nfs && make && make install
>
> i set LD_LIBRARY_PATH and LD_RUN_PATH in my .bashrc because i do this
> so much. the cool thing with LD_RUN_PATH is that it __encodes__
> inter-library dependancies (so ruby tk.so needs libtk.so needs ...) such
> that users do not need to set LD_LIBRARY_PATH themselves. of course they
> may, but they do not have to
>
> - all users of code on this partiion need only do
>
> export PATH=/nfs/bin:$PATH
>
> i have a /nfs/build and /nfs/packages - you can guess what these are for
> if you like this approach you may want to check out gnu stowe. i find
> it easy enough to do by hand though...


Thanks very much! I haven't tried this yet, but it looks like it should solve
a lot of my problems.

Randy Kramer


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
translating Python to Assembler...sorry if this is duplicated...it's unintentional over@thepond.com Python 2 01-23-2008 12:28 PM
Unintentional switching between windows Jim Beaver Computer Support 0 08-26-2006 07:01 PM
[ADV] Shameless Hype for Ruby Stuff Goodness James Britt Ruby 2 02-19-2006 07:13 PM
Unintentional B&W tint ... PcB Digital Photography 21 01-29-2006 04:48 PM
DVD Verdict reviews: AUGUSTUS, PHONE, HYPE, YVES SAINT LAURENT: HIS LIFE AND TIMES/5 AVENUE MARCEAU 75116 PARIS, and more! DVD Verdict DVD Video 0 02-17-2005 10:13 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57