Thread overview | ||||||
---|---|---|---|---|---|---|
|
July 18, 2012 [dmd-internals] longdouble and splitting off typedefs in mars.h | ||||
---|---|---|---|---|
| ||||
Hi, I have recently started moving across longdouble.h, and the use of ldouble() over into GDC's copy of the D frontend from upstream DMD. I see there's an (attempted?) implementation for GDC already in longdouble.h https://github.com/D-Programming-Language/dmd/blob/master/src/root/longdouble.h#L16 However, this does not work as GDC's real_t implementation relies on some typedef's in mars.h, and #include mars.h won't work as mars.h depends upon longdouble.h. The only way I can see around it is to split off all integral and floating typedefs (perhaps not complex_t) from mars.h into a new header named - eg, coretypes.h. Would it be ok if I perform this slight internal move about and pull it into DMD? Regards -- Iain Buclaw *(p < e ? p++ : p) = (c & 0x0f) + '0'; _______________________________________________ dmd-internals mailing list dmd-internals@puremagic.com http://lists.puremagic.com/mailman/listinfo/dmd-internals |
July 18, 2012 Re: [dmd-internals] longdouble and splitting off typedefs in mars.h | ||||
---|---|---|---|---|
| ||||
Posted in reply to Iain Buclaw | On 18.07.2012 09:13, Iain Buclaw wrote: > Hi, > > I have recently started moving across longdouble.h, and the use of > ldouble() over into GDC's copy of the D frontend from upstream DMD. I > see there's an (attempted?) implementation for GDC already in > longdouble.h > > https://github.com/D-Programming-Language/dmd/blob/master/src/root/longdouble.h#L16 This was just guesswork, as I could not try it out. I wonder why the real_t implementation is necessary at all, as GCC seems to be capable of 80-bit floating points with "long double". At least that is how DMD is built on posix systems. So maybe you can also use the !_MSC_VER branch of the conditional. > > However, this does not work as GDC's real_t implementation relies on > some typedef's in mars.h, and #include mars.h won't work as mars.h > depends upon longdouble.h. The only way I can see around it is to > split off all integral and floating typedefs (perhaps not complex_t) > from mars.h into a new header named - eg, coretypes.h. Would it be ok > if I perform this slight internal move about and pull it into DMD? > > > Regards > _______________________________________________ dmd-internals mailing list dmd-internals@puremagic.com http://lists.puremagic.com/mailman/listinfo/dmd-internals |
July 18, 2012 Re: [dmd-internals] longdouble and splitting off typedefs in mars.h | ||||
---|---|---|---|---|
| ||||
Posted in reply to Rainer Schuetze | On 18 July 2012 18:46, Rainer Schuetze <r.sagitario@gmx.de> wrote: > On 18.07.2012 09:13, Iain Buclaw wrote: >> >> Hi, >> >> I have recently started moving across longdouble.h, and the use of ldouble() over into GDC's copy of the D frontend from upstream DMD. I see there's an (attempted?) implementation for GDC already in longdouble.h >> >> >> https://github.com/D-Programming-Language/dmd/blob/master/src/root/longdouble.h#L16 > > > This was just guesswork, as I could not try it out. > > I wonder why the real_t implementation is necessary at all, as GCC seems to be capable of 80-bit floating points with "long double". At least that is how DMD is built on posix systems. So maybe you can also use the !_MSC_VER branch of the conditional. > > It's there because there are a variety of representations for floating point numbers. This means that in a cross-compiler the representation of floating point numbers in the compiled program may be different from that used in the machine doing the compilation. Therefore, a cross compiler cannot safely use the host machine's floating point arithmetic; it must emulate the target's arithmetic. To ensure consistency, GCC always uses emulation to work with floating point values, even when the host and target floating point formats are identical. -- Iain Buclaw *(p < e ? p++ : p) = (c & 0x0f) + '0'; _______________________________________________ dmd-internals mailing list dmd-internals@puremagic.com http://lists.puremagic.com/mailman/listinfo/dmd-internals |
July 27, 2012 Re: [dmd-internals] longdouble and splitting off typedefs in mars.h | ||||
---|---|---|---|---|
| ||||
Posted in reply to Iain Buclaw | On 18 July 2012 19:13, Iain Buclaw <ibuclaw@ubuntu.com> wrote: > On 18 July 2012 18:46, Rainer Schuetze <r.sagitario@gmx.de> wrote: >> On 18.07.2012 09:13, Iain Buclaw wrote: >>> >>> Hi, >>> >>> I have recently started moving across longdouble.h, and the use of ldouble() over into GDC's copy of the D frontend from upstream DMD. I see there's an (attempted?) implementation for GDC already in longdouble.h >>> >>> >>> https://github.com/D-Programming-Language/dmd/blob/master/src/root/longdouble.h#L16 >> >> >> This was just guesswork, as I could not try it out. >> >> I wonder why the real_t implementation is necessary at all, as GCC seems to be capable of 80-bit floating points with "long double". At least that is how DMD is built on posix systems. So maybe you can also use the !_MSC_VER branch of the conditional. >> >> > > It's there because there are a variety of representations for floating point numbers. This means that in a cross-compiler the representation of floating point numbers in the compiled program may be different from that used in the machine doing the compilation. Therefore, a cross compiler cannot safely use the host machine's floating point arithmetic; it must emulate the target's arithmetic. To ensure consistency, GCC always uses emulation to work with floating point values, even when the host and target floating point formats are identical. > I've actually found no harm putting it in the gdc real_t header instead. So don't need the longdouble header afterall. :) https://github.com/D-Programming-GDC/GDC/commit/d3dc166ff6f533712b07e05570cb9995c29b441b#L2R101 -- Iain Buclaw *(p < e ? p++ : p) = (c & 0x0f) + '0'; _______________________________________________ dmd-internals mailing list dmd-internals@puremagic.com http://lists.puremagic.com/mailman/listinfo/dmd-internals |
Copyright © 1999-2021 by the D Language Foundation