uint256 amount = 5000000,
the type of the expression
and its value is
And when you divide
100, the result is obviously
I don't know anything about the type
ufixed8x2, but assuming that it handles arithmetic operations correctly, you should cast the intermediate result of
57 to this type before dividing it by
In other words, change this:
profit = ufixed8x2(amount.div(24).div(60).div(60).mul(PERCENT_DIVIDER).div(100));
profit = ufixed8x2(amount.div(24).div(60).div(60).mul(PERCENT_DIVIDER)).div(100);
At least in other strongly-typed languages, this method does the job.
div method is not implemented for the
ufixed8x2 type, then you can either implement it for this type, or just replace it with a simple
/ (which you may as well do for all the other occurrences of this method in your code, since there is no benefit in calling it with a constant value - it is a pure waste of gas).