Support Board
Date/Time: Wed, 22 Jan 2025 00:33:47 +0000
Post From: is there any ACSIL function that rounds
[2018-08-17 14:55:12] |
User61576 - Posts: 445 |
well, found out that i didn't defined my problem correctly and i was trying to compare 2 price i thought if i will round both i could compare tham but found that the floating points keeps all the digits... bottom line the solution i found is to create a function to compare 2 arguments and work upon the result of the functions: int compare(float f1, float f2)
{ float epsilon = 0.00001; long float diff = fabs(f1 - f2); if (diff < epsilon) return 0; else if (f1 > f2) return 1; else return - 1; } I hope this will be useful for someone else as well |