On 21 November 2013 16:27, Glenn Fowler <[email protected]> wrote:
> On Thu, Nov 21, 2013 at 10:23 AM, Cedric Blancher
> <[email protected]> wrote:
>>
>> On 21 November 2013 15:36, Glenn Fowler <[email protected]> wrote:
>> > On Thu, Nov 21, 2013 at 9:05 AM, Cedric Blancher
>> > <[email protected]>
>> > wrote:
>> >>
>> >> On 21 November 2013 14:34, Glenn Fowler <[email protected]>
>> >> wrote:
>> >> > nice find
>> >> > proposed descriptions for getpayload[fl]() setpayload[fl]()
>> >>
>> >> What are the exact prototypes for a float, double and long double
>> >> arguments?
>> >>
>> >> > setpayloadsig[fl]() are in
>> >> > http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1664.pdf
>> >> > as a bonus these functions provide a way to create a nan without
>> >> > resorting
>> >> > to strtod("nan",0)
>> >> > i.e., exactly what ast need because it provides strtod() sfscanf()
>> >> > etc.
>> >> > this is what i was anticipating in the ast nan payload patch
>> >> >
>> >> > the only disconnect is that the api deals with floating payloads but
>> >> > describes the payloads themselves as non-negative integers
>> >> > I guess they do this in case the largest payload value is greater
>> >> > than
>> >> > the
>> >> > largest native integer
>> >>
>> >> nans can only be positive integers >= 1
>> >
>> >
>> > the proposed api probably needs some tightening
>> > its does not mention what is returned for a nan that has no payload
>> > specified
>>
>> Its undefined and implementation specific? :)
>
>
> getpayload() would need an error indication or the whole api would be
> useless (no way to determine nan that has no payload)
> presumably they expect the caller to have somehow verified isnan(x) before
> calling getpayload(&x)
> it would then be reasonable to return 0 for nans with no payload

Ah. I understand now. Nans always have a payload. IEEE754 defines the
floating point types that way. The question, as Roland found out, is
which value is the default nan payload used by the NAN macro and the
nan("") function.

Ced
-- 
Cedric Blancher <[email protected]>
Institute Pasteur
_______________________________________________
ast-developers mailing list
[email protected]
http://lists.research.att.com/mailman/listinfo/ast-developers

Reply via email to