[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] compile time "exotic" floating-point constants

From: grischka
Subject: Re: [Tinycc-devel] compile time "exotic" floating-point constants
Date: Wed, 05 May 2010 23:13:01 +0200
User-agent: Thunderbird (Windows/20090812)

Someone please push this patch?  Thanks,

--- grischka

Tomas Lindquist Olsen wrote:
Hi all.

I'm working on a compiler project where one of our targets is C, for
this I've found TinyCC very interesting and useful.

There was one issue though, which was not being able to (or at least I
couldn't figure out how) to use special floating-point constants like
NaN in a fashion that is truly a compile time constant.

So I made a patch (against the last stable release). I'm not used to
Git, and failed to get it working on my Windows7 machine, so I hope
it's OK to provide a patch here.

Of course I'd like to know if there's a possibility to get the patch
included in the official repo, and if not, maybe we can find some way
to let me do what I want.

Basically the patch adds three new special-identifiers: __nan__ ,
__snan__ and __inf__ . All have the type 'double' and are quiet-nan,
signaling-nan and infinity. Other types can simply cast, like

A more flexible alternative is a kind of builtin, like
'__builtin_hex_double(0x7ff0000000000000)' etc. If this would be more
desirable I can make a patch with that instead.

Let me know what you think, patch is attached.

Tomas Lindquist Olsen

reply via email to

[Prev in Thread] Current Thread [Next in Thread]