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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T22:49:22+00:00 2026-06-14T22:49:22+00:00

In my asp code, I have 4 variables with different values. chAmount = 19.99

  • 0

In my asp code, I have 4 variables with different values.

chAmount = 19.99
totalRefundAmount =0
voidQueueRefundAmount =15.99
amount=4

when I execute following statement

if (CDbl(chAmount) + CDbl(totalRefundAmount) - CDbl(voidQueueRefundAmount) - CDbl(amount) < 0.00) then
end if

The if condition is true while it should not be because the answer of above expression should be 0 and it should not go in the if loop but it is going inside the loop .

I am getting -1.77635683940025E-15 in the visual studio debugger for the expression CDbl(chAmount) + CDbl(totalRefundAmount) - CDbl(voidQueueRefundAmount) - CDbl(amount)

see this following screenshot of visual studio debugger.
http://screencast.com/t/73PyutXB07R1

  • 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-06-14T22:49:24+00:00Added an answer on June 14, 2026 at 10:49 pm

    That’s because the Double you’re converting to is a floating point.

    Why convert to Double when you are dealing with currencies? Use CCur() instead of CDbl().

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

Sidebar

Related Questions

I have the following shortened classic ASP code that makes a SQL insert call...
I have following asp.net code but it gives error when I change dropdown selected
I have somebody elses code (C# ASP.Net) which contains the following query: string query
I have a templating system that looks similar to old-style ASP code. I run
I have ASP.Net code generating my button's HTML for me using divs to get
I have ajax code for asp.net (non-mvc) to call to a webMethod to get
We have some legacy ASP.NET code that detects if a request is secure, and
I have code below: <select id=testSelect> <option value=1>One</option> <option value=2>Two</option> </select> <asp:Button ID=btnTest runat=server
I have this code in my ASP.NET application written in C# that is trying
I have a code base that has been used as an ASP.Net web application.

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.