I had problems with getting values with 2 decimals after some calculations. SOmetimes an invoice isn't calculated correctly. After a long time searching, I found that there is a problem with the following code:
Code: Select all
set decimals to 6
s1 := 22.90
@ 1,1 dcsay "Value of s1: " get s1 saysize 40 sayright getsize 20 when .F.
s2 := s1 * (100-15) / 100
@ 2,1 dcsay "s2 := s1 * 85 / 100" get s2 saysize 40 sayright getsize 20 when .F.
s3 := round(s2,2)
@ 3,1 dcsay "s3 := round(s2,2)" get s3 saysize 40 sayright getsize 20 when .F.
s4 := s2*100+0.5
@ 4,1 dcsay "s4 := s2*100+0.5" get s4 saysize 40 sayright getsize 20 when .F.
s5 := int(s4)
@ 5,1 dcsay "s5 := int(s4)" get s5 saysize 40 sayright getsize 20 when .F.
s6 := int(s4)/100
@ 5,1 dcsay "s6 := int(s4)/100" get s6 saysize 40 sayright getsize 20 when .F.
dcread gui fit addbuttons to lok