Problems with Math.Truncate(num)
as the question suggests (more of a statement sorry) I'm having problems
using math.truncate in C#. What I'm trying to do is say when the decimal
of a number divided by 50 is equal to 0.4 do this, as such:
double temp2 = 170;
temp2 = temp2 / 50; //this equals 3.4
temp2 -= Math.Truncate(temp2);
if (temp2 == 0.4)
{
Console.WriteLine("Hello");
}
However when I try to do this it's not working for me and I'm unsure why
it's not working, would I be able to get someone to shed some light on
this and put me in the right direction please?
No comments:
Post a Comment