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
ASKER CERTIFIED SOLUTION
Avatar of Dirk Haest
Dirk Haest
Flag of Belgium image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of benjern
benjern

ASKER

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
ASP.NET
ASP.NET

The successor to Active Server Pages, ASP.NET websites utilize the .NET framework to produce dynamic, data and content-driven web applications and services. ASP.NET code can be written using any .NET supported language. As of 2009, ASP.NET can also apply the Model-View-Controller (MVC) pattern to web applications

128K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo