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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T10:54:47+00:00 2026-05-20T10:54:47+00:00

What difference does it make when I use float and decimal data types in

  • 0

What difference does it make when I use float and decimal data types in MySQL?.

When should I use which?

  • 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-20T10:54:47+00:00Added an answer on May 20, 2026 at 10:54 am

    This is what I found when I had this doubt.

    mysql> create table numbers (a decimal(10,2), b float);
    mysql> insert into numbers values (100, 100);
    mysql> select @a := (a/3), @b := (b/3), @a * 3, @b * 3 from numbers \G
    *************************** 1. row ***************************
      @a := (a/3): 33.333333333
      @b := (b/3): 33.333333333333
    @a + @a + @a: 99.999999999000000000000000000000
    @b + @b + @b: 100
    

    The decimal did exactly what’s supposed to do on this cases, it
    truncated the rest, thus losing the 1/3 part.

    So for sums the decimal is better, but for divisions the float is
    better, up to some point, of course. I mean, using DECIMAL will not give
    you a "fail proof arithmetic" in any means.

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

Sidebar

Related Questions

Should we use object or variant ? What difference does it make?
Does it make a difference which one I use in objective-c (particularly on iOS)?
What difference does it make when I use a const parameter in a procedure?
Does it make any difference to prefer varchar2 over date data type when building
Does it make any difference if I use e.g. short or char type of
Does it make any difference in C99 when one writes const int x =
When using on_start() does it make any difference to do, // ENABLE GZIP COMPRESSION
Does the length of the CommandText of an SqlCommand make a difference? I'm not
When performing many disk operations, does multithreading help, hinder, or make no difference? For
From a pure speed perspective of compiled code, does it make a difference if

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.