This is an awkward error, we're having in an ASP.NET MVC 3 application. I thought it to be highly likely some bug in our code (it still might be), but I just couldn't find any indications to it.
Here's what's happening:
When the user types in a number
N into a specific form, different fields within that form, so that
N > 1,000 the number was divided by 1,000 and rounded to the nearest integer. For instance, 35,686 would become 36, but 35,423 would become 35. So far this happened only twice, within two weeks, although the users are using this particular form every day. Typing in the numbers again, took over the correct number.
The user types in, for instance
35686 (without any separators) and in 1 out of ~100 cases,
36 is stored in the DB instead of
35686. The weirdest thing is, that it gets rounded. Usually casting a doubly value, such as
35.686 would just cut off the decimal digits and result in
As our users are mostly using the German culture we thought, somebody wrote
. being the German thousands delimiter) and it got casted to integer. However, this wouldn't cause a rounding (or would it) and anyway - when we tested it, whatever language culture (English and German) we used and whatever delimiter (
.) we always got an Exception from the server indicating, the number should be without delimiters.
Checking the application, there are no occurrences of
round in C# code, nor JS code. Neither could I find any
0.5 (the simplest way to round a double to the nearest integer is
+0.5 and cast to int). I also didn't find any division by 1,000.
Is there anything we might have missed? The browser which is used by our users is IE 11 with Windows 7. The application is running on Windows Server 2012 on the latest version of .Net in IIS. Do you have any ideas?