If you put the following into App Engine Shell you get '50.49'. This result is consistent on both the 2.5 and 2.7 runtimes.
>> a = '%0.2f' % (round(float(u'50.485'), 2),)
>> a
'50.49'
However if I put the same thing into my local MacBook Pro running python 2.7.1 I get '50.48'.
>> a = '%0.2f' % (round(float(u'50.485'), 2),)
>> a
'50.48'
Why is this different and how can I get consistency between my local machine and App Engine’s servers?
Apparently, Google App Engine uses “float” C type (IEEE 754 single precision), while local Python uses “double” instead (IEEE 754 double precision).
I have suspected that CPython has a configure switch to use ‘float’ instead of ‘double’, but haven’t found one.