Page 1 of 1

Getting negative value of decimal field

Posted: Thu Sep 25, 2008 4:49 am
by swathi Singamareddygari
Hi,

I want to get a negative value of a decimal field.

MY input is 1112223334567822.22
I want output as - 1112223334567822.22

For this i gave output as -1*input

but i am getting output as -1112223334567822.24 instead of -1112223334567822.22

When i am using NEG function i am facing same problem


Please help me

Thanks for ur help

Regards

Swathi S

Posted: Mon Feb 02, 2009 3:40 am
by kishore2456
Try Abs(input)
If it doesnt work, try this

if input > 0 then input * -1 else input

Posted: Mon Feb 02, 2009 4:14 am
by ray.wurlod
What is the data type of the input field and of the output field? Search DSXchange for discussion of how/why floating point numbers can not be stored to full accuracy in computers.