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 3675714
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T03:00:38+00:00 2026-05-19T03:00:38+00:00

Basically i want to search for the smallest (positive) value from a bunch of

  • 0

Basically i want to search for the smallest (positive) value from a bunch of values and need a default value to compare to the first one. The naïve assumption would be, they always compare “less than” (except NaNs, but let’s not consider those) but I’m not quite sure.

I’m using the float type and I think it can safely be assumed that my target hardware implements a infinity value.

Here’s some example code:

auto leastValue = std::numeric_limits<float>::infinity();
for (auto i = something.begin(), e = something.end(); i != e; ++i)
{
  auto value = (*i)->GetValue();
  if (value < leastValue)
  {
    leastValue = value;
  }
}
  • 1 1 Answer
  • 0 Views
  • 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. Editorial Team
    Editorial Team
    2026-05-19T03:00:39+00:00Added an answer on May 19, 2026 at 3:00 am

    For IEEE 754 floats, except NaN and infinity, everything is less than infinity. Chances are you’ll have those on your platform. If you’re paranoid, check with numeric_limits<float>::is_iec559. If your platform happens to be not conforming, use numeric_limits<float>::max(); if your sequence is nonempty, it will not give you a wrong result.

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

Sidebar

Related Questions

I need to return only the facet counts from solr. So I basically want
I want to search for a string in another one (basically what strstr does
Basically I do not want to be penalized by search engine for duplicate contents.
I basically want to open a browser window from Word using VBA that does
Basically i want to add wildcards to the the col value when searching... Usually
When giving PHP in_array an array of values I want to search for, it
I had search on google, but didn't have any luck. Basically I want this
I basically want the same functionality of preg_match_all() from PHP in a Python way.
I basically want to detect the path from where users are getting to my
I basically want something like: TextView Button Button . . . TextView TextView SeekBar

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.