I have two values First one is 263926176.9 and Second One is 263926176.9 Both are same I am trying to subracting this Expecting output as 0 But I am getting this Value -2.98023E-08

Suggest a Correct way to get 0 in Output, Working in Excel

Hi @Gopikrishna_S ,

How are you subtracting, can you please show.

Thanks

Hi @Gopikrishna_S

Try out the below syntax

Double_output = Convert.ToDouble(input_variable1)-Convert.ToDouble(input_variable2)

Where double_output is double variable type

Thanks
Robin

Hi,

Can you check both variable as the following?

doubleVar1.ToString("F15")
doubleVar2.ToString("F15")

If they are not same and you can round to one decimal place, can you try the following expression?

doubleVar1=Math.Round(doubleVar1,1,MidpointRounding.AwayFromZero)
doubleVar2=Math.Round(doubleVar2,1,MidpointRounding.AwayFromZero)

Regards,

what did mean “F15”

Hi,

Sorry, I had a mistake. It should be “G17”.
Can you take a look the following workflow and its result?

In double type, it might have some error due to floating point error.
This means even if they looks same value, actual value might not be same.

The following document might also help you.

Regards,

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