# Equivalent to Java's Float.MAX\_VALUE?

**URL:** https://rubytalk.org/t/equivalent-to-javas-float-max-value/4625
**Category:** ruby-talk
**Created:** [10 February 2003 13:37 UTC](https://rubytalk.org/t/equivalent-to-javas-float-max-value/4625 "2003-02-10T13:37:47Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Farrel\_Lifson1](https://avatars.discourse-cdn.com/v4/letter/f/9fc348/32.png) [@Farrel\_Lifson1](https://rubytalk.org/u/Farrel_Lifson1)
#### Post date: [10 February 2003 13:37 UTC](https://rubytalk.org/t/equivalent-to-javas-float-max-value/4625/1 "2003-02-10T13:37:47Z")

</div>

Hi all,

Does Ruby have an equivalent to Java’s Float.MIN\_VALUE and  
Float.MAX\_VALUE (the smallest and largest finite numbers representable  
respectively)? The pickaxe book doesn’t mention anything as such but  
perhaps it has been added in newer Ruby versions.

Thanks in advance,  
Farrel Lifson

> **···**
>
> –
> 
> > Data Network Architecture Research Lab [mailto:flifson@cs.uct.ac.za](mailto:flifson@cs.uct.ac.za)  
> > Dept. of Computer Science [http://people.cs.uct.ac.za/~flifson](http://people.cs.uct.ac.za/~flifson)  
> > University of Cape Town +27-21-650-3127

---

<div class="post-metadata">

### Author: ![Robert](https://avatars.discourse-cdn.com/v4/letter/r/e95f7d/32.png) [@Robert](https://rubytalk.org/u/Robert)
#### Post date: [10 February 2003 13:54 UTC](https://rubytalk.org/t/equivalent-to-javas-float-max-value/4625/2 "2003-02-10T13:54:06Z")

</div>

Float INFINITY = 1.0 / 0.0

Since floats do grow arbitrarily there is no other bound as system memory.

```
robert

```

“Farrel Lifson” [flifson@cs.uct.ac.za](mailto:flifson@cs.uct.ac.za) schrieb im Newsbeitrag  
news:1044884446.23956.4.camel@asgard.cs.uct.ac.za…

> Hi all,
> 
> Does Ruby have an equivalent to Java’s Float.MIN\_VALUE and  
> Float.MAX\_VALUE (the smallest and largest finite numbers representable  
> respectively)? The pickaxe book doesn’t mention anything as such but  
> perhaps it has been added in newer Ruby versions.
> 
> ## Thanks in advance, Farrel Lifson
> 
> > Data Network Architecture Research Lab [mailto:flifson@cs.uct.ac.za](mailto:flifson@cs.uct.ac.za)  
> > Dept. of Computer Science  
> > [http://people.cs.uct.ac.za/~flifson](http://people.cs.uct.ac.za/~flifson)

> **···**
>
> > > University of Cape Town +27-21-650-3127

---

<div class="post-metadata">

### Author: ![Yukihiro\_Matsumoto2](https://avatars.discourse-cdn.com/v4/letter/y/b9e5f3/32.png) [@Yukihiro\_Matsumoto2](https://rubytalk.org/u/Yukihiro_Matsumoto2)
#### Post date: [10 February 2003 14:09 UTC](https://rubytalk.org/t/equivalent-to-javas-float-max-value/4625/3 "2003-02-10T14:09:21Z")

</div>

Hi,

> **···**
>
> In message “Equivalent to Java’s Float.MAX\_VALUE?” on 03/02/10, Farrel Lifson [flifson@cs.uct.ac.za](mailto:flifson@cs.uct.ac.za) writes:
> 
> > Does Ruby have an equivalent to Java’s Float.MIN\_VALUE and  
> > Float.MAX\_VALUE (the smallest and largest finite numbers representable  
> > respectively)? The pickaxe book doesn’t mention anything as such but  
> > perhaps it has been added in newer Ruby versions.
> 
> Float::MAX in 1.8.0
> 
> ```
> matz.
> 
> ```

---

<div class="post-metadata">

### Author: ![Nobuyoshi\_Nakada](https://avatars.discourse-cdn.com/v4/letter/n/edb3f5/32.png) [@Nobuyoshi\_Nakada](https://rubytalk.org/u/Nobuyoshi_Nakada)
#### Post date: [10 February 2003 14:14 UTC](https://rubytalk.org/t/equivalent-to-javas-float-max-value/4625/4 "2003-02-10T14:14:14Z")

</div>

Hi,

> Does Ruby have an equivalent to Java’s Float.MIN\_VALUE and  
> Float.MAX\_VALUE (the smallest and largest finite numbers representable  
> respectively)? The pickaxe book doesn’t mention anything as such but  
> perhaps it has been added in newer Ruby versions.

Float::MIN and Float::MAX have been added in 1.8.

> **···**
>
> At Mon, 10 Feb 2003 22:37:47 +0900, Farrel Lifson wrote:
> 
> At Mon, 10 Feb 2003 22:54:06 +0900, Robert Klemme wrote:
> 
> > Since floats do grow arbitrarily there is no other bound as system memory.
> 
> That’s Bignum.
> 
> –  
> Nobu Nakada

---

<div class="post-metadata">

### Author: ![Farrel\_Lifson1](https://avatars.discourse-cdn.com/v4/letter/f/9fc348/32.png) [@Farrel\_Lifson1](https://rubytalk.org/u/Farrel_Lifson1)
#### Post date: [10 February 2003 14:13 UTC](https://rubytalk.org/t/equivalent-to-javas-float-max-value/4625/5 "2003-02-10T14:13:41Z")

</div>

I assume there will be a corresponding Float::MIN?

Farrel

> **···**
>
> –
> 
> > Data Network Architecture Research Lab [mailto:flifson@cs.uct.ac.za](mailto:flifson@cs.uct.ac.za)  
> > Dept. of Computer Science [http://people.cs.uct.ac.za/~flifson](http://people.cs.uct.ac.za/~flifson)  
> > University of Cape Town +27-21-650-3127

---

<div class="post-metadata">

### Author: ![Robert](https://avatars.discourse-cdn.com/v4/letter/r/e95f7d/32.png) [@Robert](https://rubytalk.org/u/Robert)
#### Post date: [10 February 2003 15:54 UTC](https://rubytalk.org/t/equivalent-to-javas-float-max-value/4625/6 "2003-02-10T15:54:22Z")

</div>

[nobu.nokada@softhome.net](mailto:nobu.nokada@softhome.net) schrieb im Newsbeitrag  
news:200302101414.h1AEEC922638@sharui.nakada.kanuma.tochigi.jp…

> Hi,
> 
> > Does Ruby have an equivalent to Java’s Float.MIN\_VALUE and  
> > Float.MAX\_VALUE (the smallest and largest finite numbers representable  
> > respectively)? The pickaxe book doesn’t mention anything as such but  
> > perhaps it has been added in newer Ruby versions.
> 
> Float::MIN and Float::MAX have been added in 1.8.
> 
> > Since floats do grow arbitrarily there is no other bound as system  
> > memory.
> 
> That’s Bignum.

Well, yes. In fact it depends on the type of application, whether you need  
inf or max.

Regards

```
robert

```

> **···**
>
> > At Mon, 10 Feb 2003 22:37:47 +0900, \> Farrel Lifson wrote:  
> > At Mon, 10 Feb 2003 22:54:06 +0900, \> Robert Klemme wrote:

---

<div class="post-metadata">

### Author: ![Yukihiro\_Matsumoto2](https://avatars.discourse-cdn.com/v4/letter/y/b9e5f3/32.png) [@Yukihiro\_Matsumoto2](https://rubytalk.org/u/Yukihiro_Matsumoto2)
#### Post date: [10 February 2003 14:35 UTC](https://rubytalk.org/t/equivalent-to-javas-float-max-value/4625/7 "2003-02-10T14:35:26Z")

</div>

Hi,

> I assume there will be a corresponding Float::MIN?

We have:

Float::ROUNDS (FLT\_ROUNDS)  
Float::RADIX (FLT\_RADIX)  
Float::MANT\_DIG (DBL\_MANT\_DIG)  
Float::DIG (DBL\_DIG)  
Float::MIN\_EXP (DBL\_MIN\_EXP)  
Float::MAX\_EXP (DBL\_MAX\_EXP)  
Float::MIN\_10\_EXP (DBL\_MIN\_10\_EXP)  
Float::MAX\_10\_EXP (DBL\_MAX\_10\_EXP)  
Float::MIN (DBL\_MIN)  
Float::MAX (DBL\_MAX)  
Float::EPSILON (DBL\_EPSILON)

```
						matz.

```

> **···**
>
> In message “Re: Equivalent to Java’s Float.MAX\_VALUE?” on 03/02/10, Farrel Lifson [flifson@cs.uct.ac.za](mailto:flifson@cs.uct.ac.za) writes:
