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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:36:14+00:00 2026-05-25T12:36:14+00:00

I am storing monetary values, and I read that FLOAT has internal rounding problems

  • 0

I am storing monetary values, and I read that FLOAT has internal rounding problems (although I can’t say I ever noticed any problems) and that it is better to use DECIMAL.

So I have been using DECIMAL but when I try to set the value to 1 it is stored as 0.99. I will be using that value in JavaScript at some point, and I know that my JS calculations will be wrong because it is 0.99 not 1.00.

Why is it doing that and should I just use FLOAT?

  • 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-25T12:36:15+00:00Added an answer on May 25, 2026 at 12:36 pm

    You need DECIMAL(4, 2) by the looks of things. DECIMAL(2, 2) only allows a range of -0.99 to 0.99

    The precision represents the number of significant digits that are stored for values, and the scale represents the number of digits that can be stored following the decimal point. so in your case you have not defined the column to allow any integer part at all.

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

Sidebar

Related Questions

When storing a bool in memcached through python-memcached I noticed that it's returned as
I need to convert a string to a monetary format of {###}.###.###,## that is
Is storing secret keys (internal use passwords and such) on iPhone source code and
We are currently storing plain text passwords for a web app that we have.
We're storing some Guid's in a MS SQL database. There's some legacy code that
I'm storing an object ( TTF_Font ) in a shared_ptr that is provided to
Storing an array submitted from forms stores elements with null values. Is there a
Storing the entire session in a cookie has been standard in Rails for the
Storing objects in heterogeneous vector with stack-allocated objects Hello, Say I have an abstract
Storing a telehone number in some kind of canonical format has several advantages from

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.