i tried using the field to enter the value again, and the bug is problem solved.

i wonder if it is due to
1. the value stored in p = 0.20000000000001 instead of 0.2 exactly is occuring
2. the condition to check maybe i change it to be less strict like 

if ( (p/f<-0.95&&p/f>-1.05&&p<0&&f>0)||(p/f<1.05&&p/f>0.95&&p>0&&f>0) ) {

maybe that will solved the bug problem?