Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: SQL Calculation 5.5/100 to get 0.055



Permlink Replies: 1 - Last Post: May 22, 2017 9:54 AM Last Post By: Jeff Overcash (...
Akah Owei

Posts: 3
Registered: 3/11/01
SQL Calculation 5.5/100 to get 0.055
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 22, 2017 1:33 AM
Dear Team,

Calculating 5.5 / 100 by a calculator gives me 0.055

Calculating with Interbase SQL gives me 0.05.

What can I do to get the right answer which is 0.055
Jeff Overcash (...

Posts: 1,529
Registered: 9/23/99
Re: SQL Calculation 5.5/100 to get 0.055
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 22, 2017 9:54 AM   in response to: Akah Owei in response to: Akah Owei
Akah Owei wrote:
Dear Team,

Calculating 5.5 / 100 by a calculator gives me 0.055

Calculating with Interbase SQL gives me 0.05.

What can I do to get the right answer which is 0.055

The precision is going to be limited by the smallest precision of the two. In
this case the 5.5. Change that to 5.500 or cast it to the precision you want like

select cast(5.5 as numeric(9,5)) / 100 from rdb$database


--
Jeff Overcash (TeamB)
(Please do not email me directly unless asked. Thank You)
Learning is finding out what you already know. Doing is demonstrating that you
know it. Teaching is reminding others that they know it as well as you. We are
all leaners, doers, teachers. (R Bach)

Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02