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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T20:45:08+00:00 2026-06-16T20:45:08+00:00

Possible Duplicate: Math.Round not keeping the trailing zero How to round double values but

  • 0

Possible Duplicate:
Math.Round not keeping the trailing zero
How to round double values but keep trailing zeros

I have a decimal that I want to round to 2 dp. So, I have used Math.Round(). When I have a number like this

23.126

I get the format that I want

23.13

But when I have something like this

23

I get

23

What I’d like is to always get 2 dp. So, in the previous example I’d like

23.00

If I have

23.1

I’d like

23.10

Any idea how I might do this?

  • 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-16T20:45:10+00:00Added an answer on June 16, 2026 at 8:45 pm

    Then you don’t want to round the value, you want to format it into a string.

    string formatted = value.ToString("N2");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Generate random between 0 - 9 but not 6 var ifanse=Math.floor(Math.random()*4)+1; var
Possible Duplicate: Division returns zero Say you have the code below. double d=16/60; //I
Possible Duplicate: Addition turns into concatenation Here's what I have... var srate = Math.round(princ
Possible Duplicate: Math - mapping numbers I have value x that can be from
Possible Duplicate: Is JavaScript’s Math broken? I'm using Math.round to round the number and
Possible Duplicate: .Net Round Bug In C#: Math.Round(2.5) result is 2 (instead of 3)!
Possible Duplicate: Evaluate math expression in string? (NSString) Hey i have got this string
Possible Duplicate: Evaluate C# string with math operators So lets say I have a
Possible Duplicate: Is JavaScript’s Floating-Point Math Broken? Note - I have read other posts
Possible Duplicate: Is JavaScript’s math broken? This seems really stupid, but when running this,

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.