开发者

Why might different computers calculate different arithmetic results in VB.NET?

I have some software written in VB.NET that performs a lot of calculations, mostly extracting jpegs to bitmaps and computing calculations on the pixels like convolutions and matrix multiplication. Different computers are giving me different results despite having identical inputs. What might be the reason?

Edit: I can't provide the algorithm because it's proprietary but I can provide all the relevant operations:

  • ULong \ ULong (Turuncating division)
  • Bitmap.Load("filename.bmp') (Load a bitmap into memory)
  • Bitmap.GetPixel(Integer, Integer) (Get a pixel's brightness)
  • Double + Double
  • Double * Double
  • Math.Sqrt(Double)
  • Math.PI
  • Math.Cos(Double)
  • ULong - ULong
  • ULong * ULong
  • ULong << ULong
  • List.OrderBy(Of Double)(Func)

Hmm... Is it possible that OrderBy is us开发者_开发技巧ing a non-stable QuickSort and that QuickSort is using a random pivot? Edit: Just tested, nope. The sort is stable.


Turns out that Bitmap.Load("filename.jpeg") doesn't always produce the same bitmap on each computer. I still don't know why that is, however.


  • one or more bugs in the software (e.g uninitialised variables) ?

  • old Intel CPU floating point division bug ?

  • numerically unstable algorithm ?


Screen Drivers - Each Driver will GUI the values differently. While the pixel count is same the color depth may differ via the screen drivers. Now setup into an array and compare that array on those machines you may see a difference of several bytes.

I would print$ the totals and see what they add up to

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜