Copy link to clipboard
Copied
Hi
I have implemented the Adobe AIR IOS ProductStore ANE and its working ok bar the return values when querying the apps IAP products
Everything returns fine bar the IAP prices
2. title : Unlocked : Premium
priceLocale: en_IE@currency=EUR
price :2.9899999999999998
3. title : Unlocked : Standard
priceLocale: en_IE@currency=EUR
price :1.9899999999999998
As you can see, the IAP products use Tier 2 and 3 pricing, which should be 1.99 and 2.99 - any ideas why it is returning the above ?
Thanks
Pete
I have not used this ANE but one simple solution would be to round the values to two decimal places (I believe toFixed(2) would do it?). At least with the two examples you provided, this would fix your problem.
Binary-based floating-point math like modern processors use can't perfectly represent some decimal numbers, it may just be a rounding error that is inherent in the IEEE floating-point standard in every modern cpu. Similar to how 1/3 in decimals requires infinite digits, some numbers that a
...Copy link to clipboard
Copied
I have not used this ANE but one simple solution would be to round the values to two decimal places (I believe toFixed(2) would do it?). At least with the two examples you provided, this would fix your problem.
Binary-based floating-point math like modern processors use can't perfectly represent some decimal numbers, it may just be a rounding error that is inherent in the IEEE floating-point standard in every modern cpu. Similar to how 1/3 in decimals requires infinite digits, some numbers that are easy to represent in decimal are hard to represent by binary computers (which they all are).
Copy link to clipboard
Copied
Thanks, I used the toFixed function . Still it should really be done on the server side.
Copy link to clipboard
Copied
yeah, financial calculations can get tricky fast, combined with the limitations of IEEE floating point.