# Float::MIN Not an actual minimum?

**URL:** <https://www.ruby-forum.com/t/float-min-not-an-actual-minimum/117839>\
**Category:** Ruby\
**Created:** [October 21, 2007, 9:30am UTC](https://www.ruby-forum.com/t/float-min-not-an-actual-minimum/117839 "2007-10-21T09:30:15Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![christian](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/b2d939/32.png) [@christian](https://www.ruby-forum.com/u/christian)\
**Post date:** [October 21, 2007, 9:30am UTC](https://www.ruby-forum.com/t/float-min-not-an-actual-minimum/117839/1 "2007-10-21T09:30:15Z")

</div>

I was curious as to why it would be possible to perform operations that  
did  
not result in zero, on a number smaller than Float::MIN. To me  
Float::MIN  
should be the smallest representable number that is not 0, yet on my  
system  
at least, I can perform valid operations on numbers smaller than  
Float::MIN.  
Is this a system dependent thing? Granted I can’t actually create the  
number  
by going ‘f = 4.94065645841247e-324’ as I get a ‘Float  
4.94065645841247e-324out of range’ warning, and the only way to create  
numbers smaller than  
Float::MIN is to either unpack a binary representation of a smaller  
number,  
or divide Float::MIN by some number, but I think that is because of  
checks  
in the source checking the exponent or something.

It just had me curious as to if this is something people are aware of,  
and  
if there is some reason for it.

unpacked = “\0\0\0\0\0\0\0\1”.unpack(‘G’).first  
smallish = Float::MIN / 100000000000000  
smallest = Float::MIN / 3002399751580330.75 # (Smallest divisor that  
will  
result in a double value of 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x01)  
toosmall = Float::MIN / 9007199254740991.5 # (Smallest divisor that will  
result in a double value of 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00)  
floatmin = Float::MIN  
puts 'Unpacked: ’ \<\< unpacked.to\_s \<\< ’ class: ’ \<\< unpacked.class.to\_s  
\<\< ’  
Finite: ’ \<\< unpacked.finite?.to\_s \<\< ’ Nan: ’ \<\< unpacked.nan?.to\_s  
puts 'Smallish: ’ \<\< smallish.to\_s \<\< ’ class: ’ \<\< smallish.class.to\_s  
\<\< ’  
Finite: ’ \<\< smallish.finite?.to\_s \<\< ’ Nan: ’ \<\< smallish.nan?.to\_s  
puts 'Smallest: ’ \<\< smallest.to\_s \<\< ’ class: ’ \<\< smallest.class.to\_s  
\<\< ’  
Finite: ’ \<\< smallest.finite?.to\_s \<\< ’ Nan: ’ \<\< smallest.nan?.to\_s  
puts 'TooSmall: ’ \<\< toosmall.to\_s \<\< ’ class: ’ \<\< toosmall.class.to\_s  
\<\< ’  
Finite: ’ \<\< toosmall.finite?.to\_s \<\< ’ Nan: ’ \<\< toosmall.nan?.to\_s  
puts 'Floatmin: ’ \<\< floatmin.to\_s \<\< ’ class: ’ \<\< floatmin.class.to\_s  
\<\< ’  
Finite: ’ \<\< floatmin.finite?.to\_s \<\< ’ Nan: ’ \<\< floatmin.nan?.to\_s

puts (smallest == unpacked).to\_s  
puts (unpacked \< Float::MIN && smallest \< Float::MIN && smallish \<  
Float::MIN).to\_s  
puts (smallish - unpacked).to\_s  
puts (smallish - smallest).to\_s  
puts (smallish - toosmall).to\_s  
puts (unpacked - smallish).to\_s  
puts (smallest - smallish).to\_s  
puts (toosmall - smallish).to\_s

puts (9007199254740991.5 - 3002399751580330.75)

====================

Unpacked: 4.94065645841247e-324 class: Float Finite: true Nan: false  
Smallish: 2.22329540628561e-322 class: Float Finite: true Nan: false  
Smallest: 4.94065645841247e-324 class: Float Finite: true Nan: false  
TooSmall: 0.0 class: Float Finite: true Nan: false  
Floatmin: 2.2250738585072e-308 class: Float Finite: true Nan: false  
true  
true  
2.17388884170148e-322  
2.17388884170148e-322  
2.22329540628561e-322  
-2.17388884170148e-322  
-2.17388884170148e-322  
-2.22329540628561e-322  
6.00479950316066e+15

–

“Every child has many wishes. Some include a wallet, two chicks and a  
cigar,  
but that’s another story.”
