sushj / android-daisy-epub-reader

Automatically exported from code.google.com/p/android-daisy-epub-reader
0 stars 0 forks source link

Calculations of timings need to be reliable #57

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
We currently use floating point values to represent the timings read from SMIL 
files. Comparing floating point values can be problematic as some values are 
impossible to represent accurately e.g. 0.1 seconds. This means our current 
code might not be able to compare accurate values, which may lead to 
complications in the code (where we try to code around inaccuracies) and bugs 
where despite our best efforts the calculations remain inaccurate, e.g. where 
the audio player may continue playing rather than finish at the correct offset.

To improve the accuracy and simplify the code we can consider using BigDecimal 
representations 
http://docs.oracle.com/javase/1.5.0/docs/api/java/math/BigDecimal.html

I've not used these before so I need to experiment first.

Original issue reported on code.google.com by julianharty on 26 Mar 2012 at 12:30

GoogleCodeExporter commented 8 years ago
Here's a useful tutorial 
http://www.opentaps.org/docs/index.php/How_to_Use_Java_BigDecimal:_A_Tutorial

Original comment by julianharty on 26 Mar 2012 at 1:23

GoogleCodeExporter commented 8 years ago
Is this really needed? Can't you use, say, a long and the time in miliseconds?

Original comment by brito....@gmail.com on 12 Apr 2012 at 2:18