[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: |
Thomas Preud'homme |
Subject: |
Re: [Tinycc-devel] compile time "exotic" floating-point constants |
Date: |
Thu, 6 May 2010 02:22:06 +0200 |
User-agent: |
KMail/1.13.3 (Linux/2.6.32-3-686; KDE/4.4.3; i686; ; ) |
On Wednesday 05 May 2010 23:13:01 grischka wrote:
> Someone please push this patch? Thanks,
>
> --- grischka
Done.
>
> 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
> > '(float)__nan__'.
> >
> > 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.
> >
> > Regards,
> > Tomas Lindquist Olsen
>
> _______________________________________________
> Tinycc-devel mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/tinycc-devel
signature.asc
Description: This is a digitally signed message part.