Difference in Sql Server value To C#

Asked

Viewed 28 times

-2

Guys I’m converting this formula here to a C code#:

declare @decPorcDescuentoTotal DECIMAL(18, 5), 
@decImporteCuota DECIMAL(18, 5),
@decImporteSA DECIMAL(18, 5),
@intCantCuotas INT


set @decImporteCuota = 65.20091
set @decImporteSA = 1820.76533
set @intCantCuotas = 26
SET @decPorcDescuentoTotal = 100 * (1 - (@decImporteCuota * CAST(26 AS int)) / @decImporteSA)  
select @decPorcDescuentoTotal

Result = 6.89500

But if instead of CAST(26 AS int) I put 26 it returns :

Result = 6.89499

I need to get to the first result using C# but when I multiply by 26 it returns the second result.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.