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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T11:59:03+00:00 2026-06-17T11:59:03+00:00

I am looking for a correct format and do math on currency in MySQL

  • 0

I am looking for a correct format and do math on currency in MySQL where the prices are dynamically calculated and as such, have a precision greater than 2dp.

calculated unit Price = 1.255
displayed price       = 1.26

If a customer orders 100 of the product:

actual total (100 * 1.255)   = 125.50
displayed total (100 * 1.26) = 126.00

So, If a customer looks at their invoice, and does the maths, they will see that they have been under charged by 50p because I will be charging them £125.50 but they will do the math for themselves and think that they should have been charged £126.00.

I think that the easiest way of tackling this problem is to truncate or round the calculated unit price like ROUND(1.255, 2) or TRUNCATE(1.255, 2) meaning that the display and the accounts will match up.

This is not a problem for very small quantities, however it does become significant when the customer orders more units.

The problem is that I don’t want to charge the customer £125.00 or £126.00 I want to charge them £125.50 for 100 items.

Any ideas or should I simply display the price to the customer in 3dp, not 2dp, but round the total?

  • 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-17T11:59:04+00:00Added an answer on June 17, 2026 at 11:59 am

    By rounding the unit price, you are destroying information. The only way to solve this is, as you suggest, to display unit prices to the customer in full.

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

Sidebar

Related Questions

I am looking for any way to have Emacs format a Python buffer by
Looking for the correct way and control to import and export of out of
Looking for the correct preg_match (or other solution) to validate a string to go
I'm looking for the correct way to export my pictures sequence into a quicktime
I am looking at code which has the correct using statements declared but yet
I am looking to the fastest and the correct way to check if a
I am looking at singletons and I was curious about the correct way to
I was looking for some solution around here and I didnt find any correct
I doubt I'm using the correct vocabulary (or tags) to explain what I'm looking
I am looking for a way to set date format in either mm/dd/yyyy or

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.