Decimal Data type (15 decimal)

Copper Contributor

Hi all respectable members,

 

I am having an issue while calculating some values in Microsoft Excel.

I've an equation where result is more than 15 decimals. In such cases, Excel is not showing the decimals after 15 decimals. I've come to know that its the normal behaviour of Excel.

However, I am looking that what logic is used by Excel (i.e Truncate, Round, RoundUp or RoundDown) after the 15 decimals.

 

For better explanation of the issue, I am posting some values :-

 

Example 1

Excel = 5.8/1200 + 1 = 1.00483333333333000000

Scientific Calculator = 5.8/1200 + 1 = 1.0048333333333333333333333333333

 

In above, it seems that Excel is Truncating the values

Example 2

Excel = (5.8/1200 + 1) ^ -1         = 0.9951899154088570

Calculator = (5.8/1200 + 1) ^ -1 = 0.99518991540885719024713882899323

In above it seems that excel is Truncating values after 15 decimals. 

Here the difference is also due to the difference result of (5.8/1200+1) ^ -1 in Excel and calculator.

Example 3

Excel = (5.8/1200 + 1) ^ -2         = 0.9904029677314890

Calculator = (5.8/1200 + 1) ^ -2 = 0.99040296773148832998554204245467

In above, it seems that excel is Rounding Up, instead of Truncating.

 

Bottom Line:-

I am looking forward a logic which I can use in Calculator or in My code, which helps to give results identical to Excel.

i.e.

Step 1 : First changing the values of 5.8/1200 + 1, which gives result identical to the Excel

Step 2 : Then changing the values of (5.8/1200 + 1) ^ any number, gives identical result to Excel.

 

Thanks in advance.

0 Replies