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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T22:58:21+00:00 2026-05-15T22:58:21+00:00

Double dblValue = 0.0001; Boolean a = (dblValue >= (1 / 1000)); Boolean b

  • 0
Double dblValue = 0.0001;
Boolean a = (dblValue >= (1 / 1000));
Boolean b = (dblValue >= 0.001);
Console.WriteLine("dblValue >= (1 / 1000) is " + a);
Console.WriteLine("dblValue >= 0.001 is " + b);
Console.ReadLine();

The above C# code evaluates ‘a’ to true and ‘b’ to false. In VB.NET, the equivalent code evaluates ‘a’ to false and ‘b’ to false. Why would ‘a’ evaluate to true?

Is there an implicit conversion I’m missing here – and why doesn’t it affect VB.NET (Strict)?

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

    The expression 1 / 1000 is evaluated (at compile time in this case, although it’s irrelevant really) using integer arithmetic in C#, so evaluates to 0. Use 1.0 / 1000 1 instead to force double arithmetic to be used.

    I believe VB always uses floating point arithmetic for /, and you have to use \ if you want to perform division using integer arithmetic, which is why you’re seeing different behaviour there.


    1 Or, as per comments, use 1d or (double) 1 or anything else that will force either of the operands to be considered to be of type double.

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

Sidebar

Ask A Question

Stats

  • Questions 531k
  • Answers 531k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer In the UIViewController class reference, Apple recommends that for iOS… May 16, 2026 at 11:53 pm
  • Editorial Team
    Editorial Team added an answer Right before invoking addMessage(), call Thread.currentThread().interrupt(). This will set the… May 16, 2026 at 11:53 pm
  • Editorial Team
    Editorial Team added an answer I am assuming that the executions of db.readTransaction and tx.executeSql… May 16, 2026 at 11:53 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

double? test = true ? null : 1.0; In my book, this is the
double Time; ... WriteFile( tmp_pipe, Time, sizeof(double), &dwWritten, NULL ); The above reports :
I know that if we want to display a double as a two decimal
double r = 11.631; double theta = 21.4; In the debugger, these are shown
double TotalMinute=300.0 double TotalMinutesAdded=1378.0 double TotalMinute=300.0 double TotalMinutesAdded=1378.0 foreach(DataRow dr in ds.Tables[0].Rows) { //Add
double d[10]; int length = 10; memset(d, length * sizeof(double), 0); //or for (int
double sqrtIt(double x, double low_guess, double high_guess) { int n = 10; int num
double deg=90; double two= 2* System.Math.PI; double rad=(two)*(deg/360); the original value when calculating manually
Double has range more than a 64-bit integer, but its precision is less dues
I have double number in a format like 34.123456789 . How can I change

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.