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

  • Home
  • SEARCH
  • 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 6355019
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T22:40:57+00:00 2026-05-24T22:40:57+00:00

Have a look at this snippet in Java: double alpha = alphaFactors.get(0, q); double

  • 0

Have a look at this snippet in Java:

double alpha = alphaFactors.get(0, q);
double beta = betaFactors.get(0, q);
if ((alpha + beta) > Double.NEGATIVE_INFINITY) {
    initialDistributionStripe.put(new IntWritable(q),
                                  new DoubleWritable(alpha + beta));
}

To avoid garbage values, I want to add to the initialDistributionStripe map the sum (alpha + beta) if and only if it is larger than Double.NEGATIVE_INFINITY, and is not equal to NaN.

I believe what I am doing is correct and I don’t need to explicitly check for ‘NaN’ because according to the IEEE 754 and Java spec, any comparisons against NaN result in false. So if alpha + beta is NaN, then ((alpha + beta) > Double.NEGATIVE_INFINITY) will be false.

Is my reasoning correct?

  • 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-24T22:40:58+00:00Added an answer on May 24, 2026 at 10:40 pm

    So if alpha + beta is NaN, then ((alpha + beta) > Double.NEGATIVE_INFINITY) will be false

    That’s correct.

    If you want to be explicit about it, you could add && !Double.isNaN(alpha + beta) (Keep in mind that alpha + beta != Double.NaN is true even though alpha + beta is indeed Double.NaN).

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

Sidebar

Related Questions

Have a look to this code snippet:- CommonService objcommonService; NetworkCredential myCredentials = new NetworkCredential(144552,
What is the purpose of the Source attribute? Have a look at this snippet:
Have a look at this code snippet struct S{ int i; int j;}; int
Have a look to this code snippet:- -(void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response { [webData setLength:
Have a look at this code snippet: int i = 10; int *pi =
Have a look at this very simple example WPF program: <Window x:Class=WpfApplication1.Window1 xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml
Have a look at this picture alt text http://www.abbeylegal.com/downloads/2009-04-01/web%20part%20top%20line.jpg Does anyone know what css
Have a look a this simple example. I don't quite understand why o1 prints
Please have a look at this form that I am trying to design with
Please have a look at this page www.pixeli.ca/issue. I have begun making a page

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.