2

I want to echo out a FLOAT value like when i used my calculator but the output is an integer. how to get the float output?

Explanation below :

here are the values :

user_rate=350
user_overtime=3


user_rate/8*user_overtime AS overtimetotal

current output is  = 131
expected output is = 131.25

1 Answer 1

5

You are performing integer arithmetic (which results in truncation of the float part). Instead use:

user_rate/8.0 * user_overtime AS overtimetotal

this will promote your expression to floating point.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.