fork(4) download
  1. using System;
  2. using System.Linq;
  3.  
  4. public class Test
  5. {
  6. public static void Main()
  7. {
  8. Console.WriteLine(IsNegative(decimal.Round(-0.001M, 2)));
  9. Console.WriteLine(IsNegative(decimal.Round(0.001M, 2)));
  10. }
  11.  
  12. private static bool IsNegative(decimal d)
  13. {
  14. return (d == decimal.Zero && decimal.GetBits(d).Last() < 0);
  15. }
  16. }
Success #stdin #stdout 0.04s 33968KB
stdin
Standard input is empty
stdout
True
False