Page 1 of 1

don't want to round a string to decimal

Posted: Mon Sep 01, 2008 4:08 am
by getsatish_gk
Inputstring=5.9999999999999999999
expectoutoput(decimal,26,8)=5.99999999

but i am getting 6.00000000 (decimal,26,8)

how to acevied this ia m using stringtodecimal

Please help

Posted: Mon Sep 01, 2008 4:24 am
by getsatish_gk
Basically i don't want to round the input value.
Is there any environment variable to disable?
[quote][/quote]

Posted: Mon Sep 01, 2008 6:36 am
by ray.wurlod
There are four rtype arguments you can use with decimal processing; ceil, floor, round_inf and trunc_zero. The default is trunc_zero.

Read about them in Appendix B of the Parallel Job Developer's Guide for more information.

Posted: Mon Sep 01, 2008 6:47 am
by AmeyJoshi14
Hi,
I am not able to recollect the exact parameter name but i think it is:
APT_DECIMAL_INTER_ROUND_MODE... :oops: or
APT_DEC_INTERM_ROUND_MODE

You can check the variable :
APT_DECIMAL_INTER_ROUND_MODE=None.

I am not able to check the result since right now i do not have the acess to DS.
Hope this will help you out! :wink:

Posted: Mon Sep 01, 2008 6:15 pm
by getsatish_gk
Hi there, Thanks for possible solutions,

Sol1:
I can applied APT_DECIMAL_INTERM_PRICISION TO NONE
-But the same results. :cry:

Sol2:
i know there are ceil,floor, round_inf and trunc_zero(default)
-But all there are meant to say how to round the input value. :oops:

But i don't want to round the input

input(varchar300)=5.99999999999
expected output(Decimal26,8)=5.99999999 but its rounding to 6.00000000
:?: :?:

Posted: Mon Sep 01, 2008 9:11 pm
by getsatish_gk
By now with several experiements i am using :o

AsDouble(Input) or DfloatToDecimal(AsDouble(pTest))
These would still round but to very less extend

Any other trick would help. 8)

Posted: Mon Sep 01, 2008 9:33 pm
by ray.wurlod
Did you try floor as the rtype?

Posted: Mon Sep 01, 2008 10:09 pm
by getsatish_gk
Thanks Ray,

'floor' option has solved one requirement i.e for not to round the values

but this will not cater for exponential values.
inputvalves=5.99999999999 and 9.9999999999999995e-07

using StringToDecimal(inputvalues,'floor') does not work for expo values

as a test job i am handling expo values as AsDouble(inputvalues)

Please advice to handle for both types in inputs.

Thanks in advance

Posted: Mon Sep 01, 2008 11:28 pm
by ray.wurlod
Keep experimenting. Curiously enough, we don't know all the answers. There are known unknowns, and there are unknown unknowns.

Post your results.

Posted: Tue Sep 02, 2008 8:19 pm
by getsatish_gk
Well.
This works DfloatToDecimal(AsDouble(Input))
even for exponential values. :wink:

But still does some minor rounding

Thanks