tryn2learn
Programmer
Help, this is making no sense! I’m having a problem with the round() function. I’m running visual 6.0. My code is like the following where salary is a variable (N 10 2) and fields a, b & c are all defined as numeric 10 2
Select a, b, c from table one into cursor query
Amount = query.a + ((query.b /100) * (salary – query.c))
Rnd_amt = round(amount,2)
However, if amount = 279.77500000 then the result of rnd_amt comes out as 279.77! But, sometimes it will work. For instance, if amount is 76.97500000 the rnd_amt comes out as 76.98, which is what I expect. If the thousandths position is a 6 it rounds up each time, but when it is a 5 it seems to me that it depends on the phase of the moon or something!
My set decimals is set to 8. Rnd_amt is initialized to 0.00000000
Select a, b, c from table one into cursor query
Amount = query.a + ((query.b /100) * (salary – query.c))
Rnd_amt = round(amount,2)
However, if amount = 279.77500000 then the result of rnd_amt comes out as 279.77! But, sometimes it will work. For instance, if amount is 76.97500000 the rnd_amt comes out as 76.98, which is what I expect. If the thousandths position is a 6 it rounds up each time, but when it is a 5 it seems to me that it depends on the phase of the moon or something!
My set decimals is set to 8. Rnd_amt is initialized to 0.00000000