# Format double 0.xxx

Hello everyone,

I need help regarding a double format.

I collect datas from a terminal session.
example : price = 1.117 rate = 0.318
the initial format is String.
Then I need to convert to Double coz after i need to control the datas by doing calculs
like this one :
doublevalue1/1.08 * (1.08+ doublevlaue2/100)*(1+ doublevalue3 + 0.1)

When i collect the value 3, at the beginning it is 0.318, when I convert into Double (in order to make a calcul), i only have 318 (the zero desapears)

Can someone know I can I do to keep the format 0.000 in a double variable please ?
Hope Iâ€™m clear enought.

Maybe @ppr @PD2 you can help me out please ?
Thanks again

Najoua

@najoua.abbaci

Can you share the output by placing the 3 values?

Thanks

@najoua.abbaci
find some samples

cannot replicate the missed out 0 on 0.318
Last line shows on how to bring into 3 decimal format. Internally we do not format the double

Maybe you can share some screenshots from your implementation with us. Thanks

1 Like

Can you give me more details, sorry i understand what you did but not sure to reproduce it.

To be more precise, I collect the data in differents workflows.
I convert them into argument double type. It is okay coz I have value like 1.xxx
But in a specific Wf, i have to collect the rate from an excel file. I have a list and I have to pick the right rate. all the rate are 0.xxx format (0.318, 0.125, etc.)
So when i convert this rate into a double format, it appears with the â€śwritelineâ€ť that it returns 318 instead of 0.318 (this value is not fix and it depends on the article)

And in the following wf, I have to control and do some math.
And here, with my formula : in_PCI/1.08 * (1.08+ in_FTE/100)*(1+ in_TauxMarge + 0.1) I have a wrong answer
the â€śin_TauxMargeâ€ť (my rate) is 318, instead of 0.318

My excel file where i collect the Rate (in_TauxMarge)
I choose the right â€śMargeâ€ť according to the â€śrayonâ€ť (with a lookup activity)

After that, I store the value in a string variable that i convert into a double variable

shown in the screenshots, we can conver strings into double e.g. the Line1,2
just debug and confirm that is also in the datatable 318
if so we can investigate more on the lost 0. case

Also play wiht Changing Cell formatting, Ensure Excel Application is use â€¦

When I play the wf which collects the rate.
First i have a string variable : output = 0.318

When I convert this string into a double. Here is the result: 318
Assign is : out_TauxMin = Convert.ToDouble(str_TauxMin)

could it be the case that 0 Comma 318 is sent to the conversion (e.g. French location)?

then give a try on:

1 Like

Perfect, Iâ€™ve assigned this to my double argument : Convert.ToDouble(Double.Parse(str_TauxMin,Culture))
the variable culture (cultureinfo type) is set to : new CultureInfo(â€śfr-FRâ€ť)

So the output is now 0.318 ! perfect ! Thanks a lot !

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.