0

I have a "rounding" issue, and I would like to understand why I have different results on different devices. Also if anybody knows what is different on these devices that could explain the behavior.

So, I have this code :

public final static double round(double val, double interval) {
  return Math.floor(0.5 + (val / interval)) * interval;
}

That is returning a value different on the 1st device list and on the 2nd device list

  • LG Optimus 2x - Android 2.3.6
  • HTC Sensation - Android 2.3.3
  • HTC Desire S – Android 2.3.5
  • HTC ONE S – Android 4.1.1
  • Galaxy Trend – Android 4.0.4
  • Mororola RAZR – Android 2.3.5
  • Sony Xperia S – Android 2.3.7
  • Samsung Galaxy S2 – Android 2.3.6
  • Samsung Galaxy Ace – Android 2.3.6
  • Nexus 5 – Android 4.4.2
  • Galaxy Xcover – Android 2.3.6
  • Motorola Defy – Android 2.2.2

2nd list :

  • Samsung Google Nexus S – 4.1.1
  • Google Galaxy Nexus – 4.2.2
  • Nexus 4 – 4.3
  • Samsung Galaxy S4 – 4.2.2
  • Sony Xperia Z – 4.2.2
  • Samsung Galaxy note 2 – 4.1.2
  • Samsung S3 – 4.2.2
  • Xperia SP – 4.1.2
  • Sony Xperia M – 4.1.2
  • Sony Xperia E – 4.1.1
  • Sony Xperia T – 4.1.2
LiohAu
  • 611
  • 12
  • 36

0 Answers0