Anyone knows this issue? std/math.d(2759): Error: number '0x1p-1024' is not representable

Iain Buclaw via Digitalmars-d digitalmars-d at puremagic.com
Sat Jun 20 04:35:40 PDT 2015


On 20 June 2015 at 12:06, Walter Bright via Digitalmars-d <
digitalmars-d at puremagic.com> wrote:

> On 6/20/2015 2:48 AM, Iain Buclaw via Digitalmars-d wrote:
>
>>
>> On 20 Jun 2015 11:35, "Martin Nowak via Digitalmars-d"
>> <digitalmars-d at puremagic.com <mailto:digitalmars-d at puremagic.com>> wrote:
>>  >
>>  > On 06/20/2015 09:52 AM, Walter Bright wrote:
>>  > >
>>  > > Which C runtime are you using? The math functions in C runtimes are
>>  > > often inadequate.
>>  >
>>  > So we now call the host's C library to perform constant folding/CTFE
>> of exp?
>>  > This is a point for Iain's proposal to use a high precision floating
>>  > point implementation in the compiler to avoid machine/platform
>> differences.
>>
>> I thought dmd used the C library implementations for all intrinsics via
>> CTFE,
>> not just exp?
>>
>> In any case, isn't the problem you are seeing related to the conversion of
>> string to float? Which again dmd is at the mercy of the C library
>> implementation
>> to handle correctly.
>>
>>
> The code is the following, in lexer.c:
>
>   errno = 0;
>   (void)Port::strtod((char *)stringbuffer.data, NULL);
>   if (errno == ERANGE)
>

Ah yes, that brings back memories of fixing GDC to set errno = ERANGE if
casting the result from 160bits down returns Infinity.

Can we make this a boolean check removing the need for me to explicitly set
errno?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20150620/64b92bb3/attachment-0001.html>


More information about the Digitalmars-d mailing list