Hi i have this operation:
Field 1 type decimal
Field 2 type decimal = 672
Field 3 type double = 5
The code is:
Code
field1 = field2 - field2 * (decimal?)field3 * -1;the result i'm wating for is -> 672 - 672 * 5/100 = 638,4
instead in field1 have 4032...
in other record the result is ok
thanks

Amit MohantyRank #112 · 20K reputationPosted Jun 22, 2023, 9:28 AM EDT
If you want to calculate
field1as 672 - 672 * 5/100 (which equals 638.4), the correct code would be:field1 = field2 - field2 * ((decimal?)field3 / 100);Mic Got91 reputationPosted Jun 22, 2023, 11:04 AM EDT
Perfect, i thought it was an error conversion.
Thks again