-1
I’m starting at Dart and went to perform a simple subtraction operation with double
but the result is very strange.
For example in a subtraction of a salary of 3000 minus the ceiling of inss of 2089.60 the result would be 910.40.
When I do the print
aparece 910.4000000000001.
this is the code
void main() {
double salMin = 1045.00;
double vlSalario = 3000.00;
double tetoInss1 = 2089.60;
double tetoInss2 = 3134.4;
double tetoInss3 = 6101.06;
double fxCont2 = 1044.59;
double fxCont3 = 1044.79;
double primFaixa;
if(vlSalario > salMin && vlSalario <= tetoInss1){
primFaixa = vlSalario - salMin;
} else{
primFaixa = salMin;
}
double seguFaixa;
if(vlSalario > tetoInss1 && vlSalario <= tetoInss2){
seguFaixa = vlSalario - tetoInss1;
} else if(vlSalario > tetoInss2){
seguFaixa = fxCont2;
}
double tercFaixa;
double quarFaixa;
print(primFaixa);
print(seguFaixa);
}
And your doubt? What is? EDITA your question making it clearer what you want.
– Matheus Ribeiro
https://answall.com/q/219211/101
– Maniero