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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T12:52:14+00:00 2026-06-11T12:52:14+00:00

In all other languages (arithmetic engines in general) putting an extra set of parenthesis

  • 0

In all other languages (arithmetic engines in general) putting an extra set of parenthesis around operators of same priority does not impact results. But recently in a testing project I noticed that MS SQL server changes the results in those cases. Please take a look at the query below, and let me know if you have any idea (or a setting in SQL Server administration) or any links to MSDN article explaining the behavior.

select (0.55 * 287.61 / 0.66) calc_no_parens
,(0.55 * (287.61 / 0.66)) calc_parens
,round(0.55 * 287.61 / 0.66,2) no_paren_round
,round(0.55 * (287.61 / 0.66),2) paren_round;

Results

Column  Record 1
calc_no_parens  239.6750000
calc_parens     239.67499985
no_paren_round  239.6800000
paren_round     239.67000000

To me, first two of them should return 239.675, and round should give 239.68.

  • 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-11T12:52:15+00:00Added an answer on June 11, 2026 at 12:52 pm

    You will get the desired result if you declare each value as Float.

    DECLARE @Float1 float, @Float2 float, @Float3 float;
    SET @Float1 = 0.55;
    SET @Float2 = 287.61;
    SET @Float3 = 0.66;
    
    select (@Float1 * @Float2 / @Float3) calc_no_parens
    ,(@Float1* (@Float2/ @Float3)) calc_parens
    ,round(@Float1 * @Float2/ @Float3,2) no_paren_round
    ,round(@Float1* (@Float2/ @Float3),2) paren_round;
    

    Output

    calc_no_parens  calc_parens no_paren_round  paren_round
    239.675          239.675    239.68           239.68
    

    You may want to see this article: So-called “exact” numerics are not at all exact!

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

Sidebar

Related Questions

Humm... I can do this easily in Java (and all other languages) but, it
I'm setting up a multi-language using gettext. Since all text from other languages are
Vim works fine for all other languages, but word detection seems wonky in python.
First of all, a disclaimer: I have experience in other languages, but am still
All other applications I've written have been network/web apps where I've used an SQL
I want to hide all other LI's in a certain UL except the LI
How to dim / fade all other windows of an application in Delphi 2009.
This works in all other browsers and I have no idea what the problem
my website consists only of one page where all other pages are loaded in
How do I print the indicated div (without manually disabling all other content on

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.