mod
-
i want the mod e.g. 2.6 mod = 6 4.0 mod =0 how can get this in C# ================= i want function to make this 2.6 =3 2.3 =3 2.1 =3 2.0 =2 is this function allready exist in C#
Palestine
-
i want the mod e.g. 2.6 mod = 6 4.0 mod =0 how can get this in C# ================= i want function to make this 2.6 =3 2.3 =3 2.1 =3 2.0 =2 is this function allready exist in C#
Palestine
-
i want the mod e.g. 2.6 mod = 6 4.0 mod =0 how can get this in C# ================= i want function to make this 2.6 =3 2.3 =3 2.1 =3 2.0 =2 is this function allready exist in C#
Palestine
The modulo operator in C# is
%
. However, the modulo operator doesn't do at all what you are asking for. Actually I'm not at all sure what you are actually asking for, but it's not modulo.TAREQ F ABUZUHRI wrote:
2.6 mod = 6 4.0 mod =0
That looks like the fraction part of a floating point number. You can do that by using the
Math.IEEEReminder
method:double num = 2.6; double fraction = Math.IEEEReminder(num, 1); // result is 0.6
TAREQ F ABUZUHRI wrote:
i want function to make this 2.6 =3 2.3 =3 2.1 =3 2.0 =2
You have to explain what you mean by that, because it doesn't make any sense at all.
--- single minded; short sighted; long gone;
-
i want the mod e.g. 2.6 mod = 6 4.0 mod =0 how can get this in C# ================= i want function to make this 2.6 =3 2.3 =3 2.1 =3 2.0 =2 is this function allready exist in C#
Palestine
Hi, I suggest you look into the Math class; it has what you need and more. The first can be done with 10.0*(floatValue % 1.0) or 10*IEEEremainder, but you should not call this mod, it is more like 10 times mod The second is a simple ceiling. :)
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips: - make Visual display line numbers: Tools/Options/TextEditor/... - show exceptions with ToString() to see all information - before you ask a question here, search CodeProject, then Google
-
i want the mod e.g. 2.6 mod = 6 4.0 mod =0 how can get this in C# ================= i want function to make this 2.6 =3 2.3 =3 2.1 =3 2.0 =2 is this function allready exist in C#
Palestine
TAREQ F ABUZUHRI wrote:
=================
Oh... Is that supposed to be some kind of separator, indicating that the text above it is a separate question from the text below it? I replied assuming that you were talking about the same question. That was far from obvious... Why not just write "and I have another qustion"?
--- single minded; short sighted; long gone;
-
i want the mod e.g. 2.6 mod = 6 4.0 mod =0 how can get this in C# ================= i want function to make this 2.6 =3 2.3 =3 2.1 =3 2.0 =2 is this function allready exist in C#
Palestine