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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:24:58+00:00 2026-05-23T16:24:58+00:00

double a = 10.123420834; double b = 100.123412321; if (a > b) { //

  • 0
double a = 10.123420834;
double b = 100.123412321;

if (a > b) {
// do something here
}

I am trying to compare the two values, the code above doesn’t seems to work. Any idea?

  • 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-23T16:24:59+00:00Added an answer on May 23, 2026 at 4:24 pm

    The code is correct.

    Note that your snippet is equivalent to

    float a = 10.123420834;
    float b = 100.123412321;
    
    if (a > b) {
    // do something here
    }
    

    since Objective C uses double by default unless the number is followed by an f.

    Also note that a < b, so the if statement will always evaluate to FALSE. Hence you may want to do

    double a = 10.123420834;
    double b = 100.123412321;
    
    if (a > b) {
    // do something here
    } else {
    // do something else here
    }
    

    to test this properly.

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

Sidebar

Related Questions

Double has Double.compare for comparing two double primitives. Why doesn't Integer have one? I
Compare double average = CalculateAverage(values.begin(), values.end()); with double average = std::for_each(values.begin(), values.end(), CalculateAverage()); What
Double iframe here. Within the Facebook Canvas iframe, we're iframing another window to starbucks.com
double peratusE = ((double)(bilanganE / calonAmbil)) * 100.00; Label peratusELabel = row.Cells[16].FindControl(peratusELabel) as Label;
double variable = Convert.ToDouble(5/100); Will return 0.0 but i expected 0.05 What can /
Double values store higher precision and are double the size of a float, but
I double clicked on EIP in register window,but seems un-editable. Why is EIP special?How
I'm producing a double panel figure in Mathematica. The Bottom panel has negative values
def double(a) a*2 end method_object = method(:double) and here's my question, how does this
double deg=90; double two= 2* System.Math.PI; double rad=(two)*(deg/360); the original value when calculating manually

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.