0

I have a field called T_Amount data type is float,

e.g= T_Amount=11800

When i make formula in query (11800/24)*35.25=17331.25

but actually if i make in calculator (11800/24)*35.25=17331.24999

i want this full figure.
user3069097
  • 59
  • 1
  • 12

1 Answers1

1

Your division is interpreted as an integer division because you have two integers being divided.

If you do the following you'll get a more decimal characters:

SELECT (11800/24.0)*35.25 

Which returns: 17331.24997650

So you need to be sure that you have 'float' values inside the division as well. So use decimal instead of float for division.

Allan S. Hansen
  • 4,013
  • 23
  • 25
  • then for getting this value what should i do? – user3069097 Apr 12 '16 at 08:58
  • You should make sure that 11800 and/or 24 is cast as a decimal number and not an integer in the division. As you can see in my example, I'm using `24.0` instead of only `24` – Allan S. Hansen Apr 12 '16 at 09:00
  • SELECT (11800.00000/24)*35.25 will give you the result with greater precision. So declare T_Amount (10,5) or your desired precision – TharunRaja Apr 12 '16 at 10:23