Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Sat, 10 Mar 2012 17:38:38 +0100
From: Szabolcs Nagy <>
Subject: Re: libm

* Rich Felker <> [2012-03-10 08:12:45 -0500]:

> On Sat, Mar 10, 2012 at 01:45:53PM +0100, Szabolcs Nagy wrote:
> > for two argument functions __RETCAST((x)+(y)) is not ok
> > if x is float, y is int then the return type should be double, not float
> > (this can be solved by a __RETCAST2(x,y) i guess)
> I don't see any better way right off...

i committed a solution
handling all the combinations turned out to be quite tricky

> Actually it's really ugly that C's promotions don't respect the size
> of the integer type when combining with floating point types. x+0.0f

i'd say that the ugly thing is that they added tgmath.h
eventhough there is no good way to do type generics in c

the implicit type conversions and promotions are already
hard to tackle in c so one should be careful anyway
(and use explicit casts when not sure)

> It would probably be nice to put the case for double before long
> double to avoid going through an extra wrapper function on LD64
> systems, but it's not a big deal.

i made the long double conditions false whenever
sizeof(double) == sizeof(long double)
so on LD64 only double functions will be used

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.