I'm trying to find the result of dividing by 100 from the TextFromField input. Here is my code:
TextFormField(
controller: _percentController,
onChange: (text) {
_setPercent(text);
}
)
void _setPercent(String? text) {
var percent = double.tryParse(text ?? '') ?? 0.0;
print('percent $percent');
percent = percent / 100;
print('new percent ${percent}');
}
If input 0.001 until 0.005 result is 0.00001 until 0.00005
If input 0.007 until 0.007 result is 0.00007000000000000001
If input 0.008 result is 0.00008
If input 0.009 result is 0.00008999999999999999
What happened to my code? There is a bug or maybe something wrong with my code?