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

Posted by Eyal on Stack Overflow See other posts from Stack Overflow or by Eyal
Published on 2010-03-10T18:45:52Z Indexed on 2010/03/13 23:05 UTC
Read the original article Hit count: 276

Filed under:
|

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 using a non-stable QuickSort and that QuickSort is using a random pivot? Edit: Just tested, nope. The sort is stable.

© Stack Overflow or respective owner

Related posts about arithmetic

Related posts about floating-point