Advertisement

05.27.2008 at 01:34PM PDT, ID: 23436271
[x]
Attachment Details

Rounding Down to the nearest tenth of a double value

Asked by jrmcintosh in Programming for ASP.NET, .NET

I have review ratings that, in the database are stored as a money value (the reason that I do this is that I've had many issues with decimals).

What I am trying to do is round down the value in the code behind to round down to the nearest tenth value. Currently in the code behind I make the money value a double and am using the round function and the format function to get my decimal to the nearest tenth. However I'm not getting the value that I want because I want to round down to the nearest tenth (i.e. I have 4.95, I want 4.9, etc.)

Here's my current code which is not correct:

       Dim x As Double
        x = 4.95
        x = System.Math.Round(x)
        x = Format$(x, "0.0")Start Free Trial
[+][-]05.27.2008 at 01:49PM PDT, ID: 21655574

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.27.2008 at 01:58PM PDT, ID: 21655631

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.27.2008 at 02:02PM PDT, ID: 21655668

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Programming for ASP.NET, .NET
Sign Up Now!
Solution Provided By: Joruus10
Participating Experts: 2
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628