Avatar of benjern
benjern asked on

ASP.NET can't seem to do simple arithmetic

I'm trying to do a REALLY REALLY simple math here using ASP.NET...

My code is as follows :
Response.Write(CDbl(25.76) + CDbl(18.0) - CDbl(43.76))

Essentially, it's supposed to print out the answer for 25.76 + 18.0 - 43.76 = 0

Problem is, it keeps giving me - 7.105427357601E-15

What in the world am I missing? It's simple arithmetic is it not?
Response.Write(CDbl(25.76) + CDbl(18.0) - CDbl(43.76))

Open in new window

ASP.NET

Avatar of undefined
Last Comment
benjern

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Dirk Haest

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
ASKER
benjern

Hi, looks like I've solved my own question :P Can't seem to delete it though.

I simply converted the figures to Cdec (decimals) instead of a Ddbl (double).

Ben
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes