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

  • SEARCH
  • Home
  • 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 6073363
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:15:46+00:00 2026-05-23T10:15:46+00:00

The round function sometime doesn’t work very well. I have in my db a

  • 0

The round function sometime doesn’t work very well. I have in my db a row like this:

field_1= 375
field_2= 0.65
field_3= 0.1 
field_4= 11

So we know that: field_1*field_2*field_3*field_4 = 268.125 so if I round it to 2 decimals -> 268.13.

But in mysql I got 268.12 -> Select round(field_1*field_2*field_3*field_4) from my table -> 268.12

This situation just happens with these values, I tried with other numbers and no problem the round works.

Any workaround about it. I tried in mysql 4.1.22, and 5.1.44 and I get the same issue. I read in other forum http://bugs.mysql.com/bug.php?id=6251 that it is not a bug, they said that it depends on the C library implementation.

  • 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-05-23T10:15:46+00:00Added an answer on May 23, 2026 at 10:15 am

    What data type are you using for those columns?

    If you want exact precision then you should use NUMERIC or DECIMAL, not FLOAT, REAL, or DOUBLE.

    From the manual:

    The DECIMAL and NUMERIC types store exact numeric data values. 
    These types are used when it is important to preserve exact precision, 
    for example with monetary data. 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How does MATLAB's round function work with .5? Like 5.5? Does it round up
I have a very basic random number function which generates a random number from
according to this question: Calling template function without <>; type inference the round function
I have a simple round function. It rounds to an even number. I want
I have 2 decimal numbers: 1999,9999 1999,99 if I use function decimal.Round(Temp, 2); then
I don't know much about Javascript, and this function I wrote doesn't seem to
I have a issue in SSRS when I use expression to use Round function
I am use the textbox value like 1455.23 , use the round function my
I have a program and it works well. See HERE . This is the
how do i round off a function. i have the following code in python

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.