Forum: Ruby float: out of range issues

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
D1535c766311cdf0dddf2269b6cd1120?d=identicon&s=25 christoph.heindl@gmail.com (Guest)
on 2009-01-13 19:00
(Received via mailing list)
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
irb(main):001:0> p 12.5
12.5

Any ideas?
83e71ad5597c8cf48a788ff02849bb12?d=identicon&s=25 Al Adolfsen (al_a)
on 2010-06-24 19:43
Attachment: temp.rb (453 Bytes)
christoph.heindl@gmail.com wrote:
> 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
> 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
Bec38d63650c8912b6ba9b557fb953b9?d=identicon&s=25 Roger Pack (rogerdpack)
on 2010-06-25 18:56
>>>ruby -e 'p 12.5'
>> -e:1: warning: Float 12.5 out of range
>> 12.5

> 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
0ec4920185b657a03edf01fff96b4e9b?d=identicon&s=25 Yukihiro Matsumoto (Guest)
on 2010-06-25 19:19
(Received via mailing list)
Hi,

In message "Re: float: out of range issues"
    on Sat, 26 Jun 2010 01:56:50 +0900, Roger Pack
<rogerpack2005@gmail.com> writes:

|> 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.

I cannot reproduce the problem on my Linux box.  strtod() on Windows
might be broken.

              matz.
A4e17f895c60ea54a1bd18dcac4df649?d=identicon&s=25 Jonathan Nielsen (Guest)
on 2010-06-25 19:42
(Received via mailing list)
On Thu, Jun 24, 2010 at 11:43 AM, Al Adolfsen <junkmail954@yahoo.com>
wrote:

>
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
43bb80b8ced0811fd6f366efd61a06ef?d=identicon&s=25 Suheyda Akyurek (suheyda)
on 2010-06-25 21:55
Jonathan Nielsen wrote:
> On Thu, Jun 24, 2010 at 11:43 AM, Al Adolfsen <junkmail954@yahoo.com>
> wrote:
>
>>
> 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


Is this maybe a version problem...cause I am using 1.9.1p378.... and I
don't get errors....
83e71ad5597c8cf48a788ff02849bb12?d=identicon&s=25 Al Adolfsen (al_a)
on 2010-06-29 18:18
Suheyda Akyurek wrote:
> Jonathan Nielsen wrote:
>> On Thu, Jun 24, 2010 at 11:43 AM, Al Adolfsen <junkmail954@yahoo.com>
>> wrote:
>>
>>>
>> 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
>
>
> 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
This topic is locked and can not be replied to.