![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | CEDoromal |
I’m trying to get the decimal part only of my number by trying to divide it to 1 and getting the remainder.
This is how I tried it:
answer = somefloat%1
However it gives me an error saying Invalid operands 'float' and 'int' in operator '%'.
So I also tried turning ‘1’ into float:
answer = somefloat%1.0
Then it gave me this Invalid operands 'float' and 'float' in operator '%'.
Can someone please tell me any other solutions for this?
You’re not looking for the reciprocal. The reciprocal of a number is the number that, when multiplied by that number, will give 1.
jandrewlong | 2019-07-18 14:30
Oops… Yeah… Sorry. I was meant to say remainder, not reciprocal. lol
Will edit now…
CEDoromal | 2019-07-18 22:34