float: out of range issues

C

christoph.heindl

Hi,

it seems I have messed up my system somehow to produce strange
floating point parsing errors (out of range).

-- Environment
This pc here is running Windows Vista SP 1 (English) and a fresh
installation of ruby (ruby 1.8.6 (2008-08-11 patchlevel 287) [i386-
mswin32]) provided by the one-click installer. My regional settings
are set so that the decimal symbol is '.' and digit grouping symbol is
','.

-- Problem
A floating point number causes an out of range error in either windows
command prompt or any .rb file.
ruby -e 'p 12.5'
-e:1: warning: Float 12.5 out of range
12.5

where '12.5' is a placeholder for any decimal number. This also
happens when placed in a .rb file.
Other entities, such as integers, cause no parsing errors.

However, in irb everything seems to be fine.
irb(main):001:0> p 12.5
12.5

Any ideas?
 
A

Al Adolfsen

Hi,

it seems I have messed up my system somehow to produce strange
floating point parsing errors (out of range).

-- Environment
This pc here is running Windows Vista SP 1 (English) and a fresh
installation of ruby (ruby 1.8.6 (2008-08-11 patchlevel 287) [i386-
mswin32]) provided by the one-click installer. My regional settings
are set so that the decimal symbol is '.' and digit grouping symbol is
','.

-- Problem
A floating point number causes an out of range error in either windows
command prompt or any .rb file.
ruby -e 'p 12.5'
-e:1: warning: Float 12.5 out of range
12.5

where '12.5' is a placeholder for any decimal number. This also
happens when placed in a .rb file.
Other entities, such as integers, cause no parsing errors.

However, in irb everything seems to be fine.
irb(main):001:0> p 12.5
12.5

Any ideas?


I'm having he same problem. Simple program (see attached temp.rb) to
calculate fahrenheit/celsius conversions. to calc. the fahrenheit
where:

f = 1.8 * (temp + 32)

The program works fine but there is a response

warning: Float 1.8 out of range.

NOBODY has answered this question as I have googled, yahoo'd and binged
this questions and the closest I get is what ide to use.

Al

Attachments:
http://www.ruby-forum.com/attachment/4819/temp.rb
 
R

Roger Pack

NOBODY has answered this question as I have googled, yahoo'd and binged
this questions and the closest I get is what ide to use.

Ping core about it, I would.
-r
 
J

Jonathan Nielsen

[Note: parts of this message were removed to make it a legal post.]

I'm having he same problem. Simple program (see attached temp.rb) to
calculate fahrenheit/celsius conversions. to calc. the fahrenheit
where:

f = 1.8 * (temp + 32)

The program works fine but there is a response

warning: Float 1.8 out of range.

Which version of Ruby are you using? I am unable to duplicate on either the
1.8.6 or 1.8.7 Windows Ruby from http://rubyinstaller.org/

<http://rubyinstaller.org/>-Jonathan Nielsen
 
A

Al Adolfsen

Suheyda said:
Is this maybe a version problem...cause I am using 1.9.1p378.... and I
don't get errors....

THANK YOU MATZ!

foolish me, I tried the code on an friends machine, and it worked. I
reinstalled Ruby, and all is well.

Thank you again matz
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,001
Messages
2,570,250
Members
46,848
Latest member
Graciela Mitchell

Latest Threads

Top