Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-3335] Android: Loss of precision with properties setDouble call

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2011-11-05T13:40:14.000+0000
Affected Version/sRelease 1.6.2
Fix Version/sSprint 2011-24, Release 1.7.2, Release 1.8.0
ComponentsAndroid
Labelsn/a
ReporterAndreas sandberg
AssigneeMarshall Culpepper
Created2011-04-15T03:42:27.000+0000
Updated2011-11-05T13:40:14.000+0000

Description

For droid, the following example fails as the setDouble and getDouble function convert the double to float and loss of precision occurs:

var now = new Date();
var a = now.getTime();
Ti.App.Properties.setDouble('SessionIDTimeStamp', a );
    
var b = Ti.App.Properties.getDouble('SessionIDTimeStamp');
Ti.API.error("After: " + Ti.App.Properties.getDouble('SessionIDTimeStamp'));

if(a == b)
{
    Ti.API.error("They are equal.");
}
else
{
    Ti.API.error("They are not equal.....???");
}

Comments

  1. Andreas sandberg 2011-04-15

    here's the pull request for the fix: https://github.com/appcelerator/titanium_mobile/pull/79">https://github.com/appcelerator/titanium_mobile/pull/79 .

  2. Marshall Culpepper 2011-06-13

    Converted functional test to drillbit test, made formatting changes, merged pull request.
  3. Don Thorp 2011-06-23

    merged to 1_7_X
  4. Natalie Huynh 2011-07-07

    Tested with 1.7.2.v20110706211037 on Droid 2.2.1 and emulator 2.3.3
  5. Don Thorp 2011-11-05

    Fixing labels.

JSON Source