Click here to Skip to main content
15,946,179 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I am building a report and I put in the standard equation of (487-556)/556. The answer should be -.12. However, the result shows -334. How? I cannot think of any sequence that would equal -334. When I change it to (487-556/556) or 487-556/556 it = -228.

What I have tried:

I have tried 487-556/556. (487-556/556). (487-556)/556
Posted
Updated 12-Mar-24 6:57am
v2
Comments
[no name] 12-Mar-24 13:23pm    
"A miminum reproduceable example". Otherwise, it's hearsay.
PIEBALDconsult 12-Mar-24 23:34pm    
What system? Some don't do the order of operations correctly.

1 solution

If I try your values I get what I expect:
SQL
SELECT (487-556)/556
Gives me 0 as it is integer arithmetic.
SQL
SELECT (487.0-556.0)/556.0
Gives me -0.1241 because it's floating point arithmetic.

Check your data sources and make sure the types are what you think they are.
 
Share this answer
 
v2
Comments
Maciej Los 13-Mar-24 5:35am    
5ed!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900