Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 5 of 5 total
Thread Miscalculation?
Fri, Aug 14 2009 4:48 AMPermanent Link

Francisco Fernandez
Hi all.

I have a trigger that have a line like this:

.
.
UPDATE TempCursor SET COSTONETO=NEWROW.PRECIO*(1-(NEWROW.DTO/100));
.
.

COSTONETO type FLOAT
PRECIO type FLOAT
DTO type DECIMAL scale 2

when NEWROW.PRECIO=15 and NEWROW.DTO=12,36 COSTONETO=13,20 --->wrong

if change to DTO type FLOAT COSTONETO=13,146 ---->ok

Can anybody tell me why?

Thanks and regards
Fri, Aug 14 2009 10:51 PMPermanent Link

Raul
Francisco Fernandez wrote:

Hi all.

I have a trigger that have a line like this:

.
.
UPDATE TempCursor SET COSTONETO=NEWROW.PRECIO*(1-(NEWROW.DTO/100));
.
.

COSTONETO type FLOAT
PRECIO type FLOAT
DTO type DECIMAL scale 2

when NEWROW.PRECIO=15 and NEWROW.DTO=12,36 COSTONETO=13,20 --->wrong

if change to DTO type FLOAT COSTONETO=13,146 ---->ok

Can anybody tell me why?

Thanks and regards
Fri, Aug 14 2009 10:54 PMPermanent Link

Raul
Sorry - the mailer ate the first reply

It looks good to me,

You're using 2 decimal precision:

so 12.36/100 = 0.12 (you have a decimal 2 variable and a constant so result should be decimal 2 variable)

15 * (1-0.12) = 15 * 0.88 = 13.2

Raul
Sat, Aug 15 2009 3:07 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Francisco


I don't know what you're using as a newreader (email) client or if you posted directly on the web but please try and avoid a line with just a single dot in it. This is what is used to signal end of message according to the standards so for any standards compliant newsreader client your message stops after "line like this"

Roy Lambert



Sat, Aug 15 2009 3:41 AMPermanent Link

Francisco Fernandez
Hi again.

Thank you Raul.

Ok Roy.
Image