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

The Archive Base Latest Questions

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

I’m using SQL Server and in one of the tables I have a nullable

  • 0

I’m using SQL Server and in one of the tables I have a nullable float column. When I look at that value in Microsoft SQL Server Management Studio I have a value in one of the records as 1.3. I also have a client app that gets data from the database via Entity Framework (EF) and it has a corresponding nullable double (double?) property for that column. Now when I get a value from the database it has 1.2999999523162842 values in it.

All these records (more than 1 million) will be used in interpolation, extrapolation, calculation and any smallest deviation becomes a significant value. So all values on the client side have to match values in the database.

I can’t round on the client side to the first decimal number, because in the database there are values with 2, 3, 4, or more decimal points.

My question is how can I make sure that all values in the database will be the same values on the client after loading them from database via EF?

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

    Isn’t float a binary floating point value in SQL Server? If so, your value isn’t really 1.3, as that isn’t exactly representable in binary floating point. Options:

    • Perhaps your field is effectively a decimal floating (or fixed) point type, in which case you should use decimal on the .NET side as well.
    • If you’re using binary floating point in SQL server, I’d expect the result in .NET to be the same: the nearest binary floating point value of the appropriate type to the number you originally entered. Just because SQL Server is showing you the value as 1.3 doesn’t mean it is exactly 1.3.

    Using my DoubleConverter, it looks like the closest double value to 1.3 is actually 1.3000000000000000444089209850062616169452667236328125 – so I’m not sure why you’d be getting the value you’re actually seeing. The closest float value is 1.2999999523162841796875, which sounds like it’s what you’re getting. So it’s as if your value in the database is being converted as a 32-bit floating point number instead of a 64-bit one.

    Is your database field actually something like FLOAT(23)? If so, that corresponds with a .NET float instead of double. That would explain things.

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

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have thousands of HTML files to process using Groovy/Java and I need to
I'm making a simple page using Google Maps API 3. My first. One marker
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I have a jquery bug and I've been looking for hours now, I can't

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.