4
Follows the code of total price that is giving floating point error`:
//Pr. Total
sgItens.Cells[5,l] := FormatFloat('###,###,###,##0.00',StrToFloat(copy(lTemp, 210, 14)));
cont:= StrToFloat(sgItens.Cells[5,l]);
valorTotal:= valorTotal+cont;
I’m trying to acquire a certain value to get the troco of the subtraction of two variables:
Below is the code of amount paid:
//Valor Pago
sgFinalizadoras.Cells[3,l] := FormatFloat('##,###,##0.00',StrToFloat(copy(lTemp, 80, 13)));
valorPago:= StrToFloat(copy(lTemp, 80, 13));
And just below the code to perform the subtraction, in case it would be the mathematical function of change and some of the lines of StringGrid, is giving floating point error:
//Troco
troco:= valorPago - valorTotal;
Edit2.Text := FormatFloat('##,###,##0.00',troco);
That I’d be missing?
Could you post which error is occurring? A description, and possibly the error line?
– carlosrafaelgn
@carlosrafaelgn, in this case would be a Floating point error, which looks like this.. "'Value' is not a Valid floating point value". This giving this error in the total value.
– Ramon Ruan
I’m sorry, but I still can’t figure out which line the error might be on. Just from the description, it seems a mistake of "," and ".".... But I’m guessing, here :)
– carlosrafaelgn
No problem @carlosrafaelgn, I found the floating point problem, it was trying to convert a value into string, and it wasn’t working, but the value was in cents, the only value I should convert is the value "CHANGE"! , the rest I should divide and find the correct value, ie Unit= "Split by 1000" and Price= "Split by 100". But thank you for your attention!!
– Ramon Ruan
Problem-free! :)
– carlosrafaelgn
Just an addendum: You don’t have to
FormatFloat('##,###,##0.00',troco), just doFormatFloat(',0.00',troco)that he will put each separate thousand in its proper place– Caputo