The pseudocode should look something like this:
If number > 1 n = 1 While(true) If(number < n) return n If(number < n*5) return n*5 n = n*10 Else n = 1.0 While(true) If(number > n/2) return n If(number > n/10) return n*2 n = n/10.0
For numbers> 1, he checks the following: if <5, 5. if <10, 10, if <50, 50. For numbers <1, he checks the following: if> 0.5 1. if> 0.1, 0, 5. and etc.
holgac
source share