views:

68

answers:

2

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.

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

  • old Intel CPU floating point division bug ?

  • numerically unstable algorithm ?

Paul R
+1 for old intel bug, i remember that one.
Rook
VB.Net shouldn't have uninitialized variables but I have all warnings turned on for those cases and there are none. Maybe List.OrderBy() is using a non-stable QuickSort with random pivot?
Eyal
+1  A: 

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.

Eyal
I am a little confused. What do you mean dosnt produce the same bitmap (sorry, im a noob and i am creating my own image manipulation library).
masfenix
The output of (new Bitmap("foo.jpg")).getPixel(10,10) might be different on each computer.
Eyal