#305 __eiszero patch for _IO_ldtostr

closed-wont-fix
nobody
2006-09-07
2006-09-06
esanfo
No

MinGW's builtin __LDBL_EPSILON__ is
1.08420217248550443401e-19L. _IO_ldtostr returns
6.00000000000000000000e-4952 to a string. The problem
appears to be in __eiszero in
mingwex/math/cephes_emath.h, where the expression

(*((long double*) a) == 0)

appears to return an incorrect result. This patch
avoids the cast from const short unsigned int * to
long double by converting the external representation
of long double to the corresponding cephes internal
representatation and calling __eiiszero, which appears
to return the correct result. The patch includes a
few minor related cleanup changes.

This patch has only been tested on WinXP version 2002,
SP2 with:
gcc version 3.4.2
ld version 2.16.91 20050827
native WinXP win32 build environment
MinGW runtime version 3.10
w32api version 3.7
GNU make 3.80

The uploaded zip file includes a dif file, cpp test
case demonstrating the bug and a makefile.

Discussion

  • esanfo
    esanfo
    2006-09-06

    __eiszero patch for _IO_ldtostr

     
    Attachments
  • Danny Smith
    Danny Smith
    2006-09-07

    Logged In: YES
    user_id=11494

    Thanks for the patch.
    The cephes-based implementation of ldtoa has been removed
    from CVS repository, and replaced with the more widely
    used gdtoa package (David Gay's generalization of his dtoa
    routines), so the patch is no longer necesssary. The long
    double gdtoa routines are exported from libmingwex.a

    Danny

    Danny

     
  • Danny Smith
    Danny Smith
    2006-09-07

    • status: open --> closed-wont-fix
     
  • esanfo
    esanfo
    2006-09-07

    Logged In: YES
    user_id=1340753

    Ok. Thanks for the info.