This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients TD22057, vstinner
Date 2008-10-13.21:21:00
SpamBayes Score 0.00021201528
Marked as misclassified No
Message-id <1223932862.59.0.26580854156.issue4114@psf.upfronthosting.co.za>
In-reply-to
Content
The problem is not from Python but from your FPU during the conversion 
from 64 bits float to 32 float (made by struct.pack). Example in C:

#include <stdio.h>
int main()
{
    float f;
    double d;
    d = 1.8183;
    printf("d=%.20f\n", d);
    f = (float)d;
    d = (double)f;
    printf("f=%.20f\n", f);
    printf("d=%.20f\n", d);
    return 0;
}

Result:
d=1.81830000000000002736   # ok
f=1.81830000877380371094   # 64->32: loose precision
d=1.81830000877380371094   # 32->64: no change
History
Date User Action Args
2008-10-13 21:21:02vstinnersetrecipients: + vstinner, TD22057
2008-10-13 21:21:02vstinnersetmessageid: <1223932862.59.0.26580854156.issue4114@psf.upfronthosting.co.za>
2008-10-13 21:21:01vstinnerlinkissue4114 messages
2008-10-13 21:21:00vstinnercreate