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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:08:37+00:00 2026-05-23T14:08:37+00:00

I have a conversion or some kind of type casting problem in my asp.net/C#

  • 0

I have a conversion or some kind of type casting problem in my asp.net/C# math app. A contractor wrote some code to calculate a relative standard error in an assembly. But when I run it, apparently doesn’t work right.

The data types are as follows:

        public double dSwx = 0.0, dSw = 100.0;
        public double dTx = 0.0, dTwn=0.0;
        public float fEstimateVal = 0.0F;       //  For Estimate Value, it should be same as Swx/Sw

        //i did a system.out on this in my web app and they came out as:
        //zeroDataCell.dSwx = 0.0;
        //zeroDataCell.dSw = 100.0;

        zeroDataCell.fEstimateVal = (float)(zeroDataCell.dSwx / zeroDataCell.dSw) * 100.0f;

       //so now zeroDataCell.fEstimateVal should be 0.0, but my code blows 
       //through the if statement below, is there some conversion problem? 
       //should i use EqualsTo?            


        if (zeroDataCell.fEstimateVal != 0.0f)
            zeroDataCell.fRse = zeroDataCell.fTwx / zeroDataCell.fEstimateVal * 100.0f;0

Why does fEstimateVal that eqauls zero stil run through the if loop?

  • 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-23T14:08:38+00:00Added an answer on May 23, 2026 at 2:08 pm

    Dealing with float/double numbers is always precision balancing. If you want to compare it against clear 0, convert it to integer and compare after.

    Or add some precisio stuff like

    ((int)(floatnumber * 100)) == 0.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code: Some functions: A::A(int i_a) {cout<<int Ctor\n;} //conversion constructor void
Is it possible to have some kind of type converter that allows Sync Framework
I have to create a regular expression for some path conversion. Example for path
Are there any standalone type conversion libraries? I have a data storage system that
I have the following code in my iPhone app CGPoint p = [StaticClass doSomethingWithA:a
I have created an Android application that includes some unit conversion tools built into
I have a requirement in doing some conversion work to send over a decimal
I've done some simple string -> DateTime conversions before using DateTime.ParseExact(), but I have
I have many js files, with some naming convention. If there any tool that
Is there any official/unofficial/informal convention for alt+key namings ? maybe, Microsoft have some internal

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.