Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 111341
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T02:22:11+00:00 2026-05-11T02:22:11+00:00

So in Ruby there is a trick to specify infinity: 1.0/0 => Infinity I

  • 0

So in Ruby there is a trick to specify infinity:

1.0/0 => Infinity 

I believe in Python you can do something like this

float('inf') 

These are just examples though, I’m sure most languages have infinity in some capacity. When would you actually use this construct in the real world? Why would using it in a range be better than just using a boolean expression? For instance

(0..1.0/0).include?(number) == (number >= 0) # True for all values of number => true 

To summarize, what I’m looking for is a real world reason to use Infinity.

EDIT: I’m looking for real world code. It’s all well and good to say this is when you ‘could’ use it, when have people actually used it.

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T02:22:11+00:00Added an answer on May 11, 2026 at 2:22 am

    Dijkstra’s Algorithm typically assigns infinity as the initial edge weights in a graph. This doesn’t have to be ‘infinity’, just some arbitrarily constant but in java I typically use Double.Infinity. I assume ruby could be used similarly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a ruby equivelent for __rmul__ in ruby? I can't seem to find
Is there a Ruby gem which can be used to create a Google Slideshow
is there some ruby code I can use to install a gem from a
I'm using this Ruby trick with __END__ and DATA to put some data inside
In Ruby is there any method that lists all the global variables available at
Is there any ruby gem/ rails plugin available for parsing the resume and importing
Is there a ruby gem or such for MySQL connection pooling that isn't part
Is there a ruby gem that will format dates relative to the current time?
In Ruby 1.9 there is a rich strftime function which enables lots of different
A client wants a multilingual site with a CMS. Is there a Ruby on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.