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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T13:41:06+00:00 2026-06-08T13:41:06+00:00

I have a project where a user can enter a decimal in a textbox.

  • 0

I have a project where a user can enter a decimal in a textbox. Now I take that value and tryparse it into a nullable float variable, which I pass to a tableAdapter to Insert or Update the DB.

Now here is where it gets wierd, if I give it a value of .24, that is what gets passed to the tableAdapter, however, when I look at what is saved to the database, it is transformed into 0.239999994635582.

I debuged it up to the insert call of the TableAdapter, and it is being passed a value of .24. My SQL server database column has a type of float.

Any idea on why this could be happening? Do I need to switch to decimal?

Thanks

  • 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-08T13:41:07+00:00Added an answer on June 8, 2026 at 1:41 pm

    The solution is the internal power of 2 representation of
    float numbers.

    Some fractional values cannot be represented very well.

    Read more here: IEEE 754 Floating point numbers

    Switching to decimal will work here, but also has impact to the performance.
    (somewhat 10 times slower than float, but you probably will never notice it)

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

Sidebar

Related Questions

Here's the situation, i want to have a user that can enter time on
I have a page where a user can enter a message, and subsequently that
I have a data model where a User can like a Project, Suggestion, Comment
I have a project where the requirements is that a end user will select
I am working on a project. This project have a user interface that we
Currently, I'm working on a project where a user can enter in custom values
I have a field that a user can input first and last name to
I have a requirment that accepts values from user input. It can be integers
I have an Asp.Net 4.0 Web Forms project that uses url routing for user
I have to start a new project where user authentication/management will be required. A

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.