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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T00:33:22+00:00 2026-05-26T00:33:22+00:00

Using Microsoft SQL Server 2008. I have a table of interest rates. I’ve manually

  • 0

Using Microsoft SQL Server 2008. I have a table of interest rates. I’ve manually verified that the data I’m trying to select does exist in the table.

This returns records:

SELECT *
  FROM [MyTable]
  WHERE [Rate]=3.99/100

This does not return records:

SELECT *
  FROM [MyTable]
  WHERE [Rate]*100=3.99

Here’s the really messed up part: As far as I can tell, this only happens when the Rate field contains a value of .035, .03625, or .0399.

Can anyone tell me why the second instance does not work? This table does have an ID field (PK), and the Rate field is FLOAT. Please let me know if you need any more info.

  • 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-26T00:33:23+00:00Added an answer on May 26, 2026 at 12:33 am

    You should use decimal not floats for interest rates. float is imprecise and you encounter rounding errors as you have discovered!

    On my machine

    WITH [MyTable]([Rate])
         AS (SELECT CAST(.0399 AS FLOAT))
    SELECT [Rate] * 100,
           CASE
             WHEN [Rate] * 100 = 3.99 THEN 'Y' ELSE 'N'
           END AS [= 3.99],
           CASE
             WHEN [Rate] * 100 > 3.989999999999999 THEN 'Y' ELSE 'N'
           END AS [> 3.989999999999999],
           CASE
             WHEN [Rate] * 100 < 3.99 THEN 'Y' ELSE 'N'
           END AS [< 3.99]
    FROM   [MyTable]  
    

    Returns

                           = 3.99 > 3.989999999999999 < 3.99
    ---------------------- ------ ------------------- ------
    3.99                   N      Y                   Y
    

    Obligatory Link: What Every Computer Scientist Should Know About Floating-Point Arithmetic

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

Sidebar

Related Questions

I am using Microsoft SQL Server. I have a Table which had been updated
I have a table with 300 million rows in Microsoft SQL Server 2008 R2.
I am using JPA 2.0 and SQL Server 2008 and I have determined that
I am using playframework with a legacy SQL Server 2008 database that has data
I am using Esri ArcMap 10.0 with Microsoft Sql Server 2008 R2 I have
I am using Microsoft SQL Server 2008. I have a stored procedure. Is there
I'm using Microsoft SQL Server 2008 Management Studio to create a relational schema by
I am using Microsoft SQL Server and I have a master-detail scenario where I
I've created a table in Microsoft Sql CE that I'm using to hold some
I have been using SQL Server 2008 for about a year now and my

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.