On Tue, 2023-08-08 at 10:09 +0800, chenxiaolong wrote: > +/* Count the number of functions with "q" as the suffix. */ > +const int MATHQ_NUMS=(int)LARCH_MAX_FTYPE_MAX-(int)LARCH_BUILTIN_HUGE_VALQ;
Format issue still not fixed. > +__float128 nanq (const char * str) > +{ > + union _FP_UNION_Q nan; > + nan.bits.frac0 = 0; > + nan.bits.frac1 = 0; > + nan.bits.exp = 0x7FFF; > + nan.bits.sign = 1; > + if (str != NULL && strlen (str) > 0) > + return nan.flt; > + return 0; > +} I don't think the logic is correct. __builtin_nanq("") should return a NaN, not 0. > + if (str != NULL && strlen (str) > 0) > + return nan.flt; Indent is 2, not 4. And we don't need to check "str != NULL" here. Calling nan()-family functions with a null tagp is deemed undefined behavior. > +__float128 nansq (const char *str) > +{ > + union _FP_UNION_Q nan; > + nan.bits.frac0 = 0; > + nan.bits.frac1 = 0; > + nan.bits.exp = 0x7FFF; > + nan.bits.sign = 1; > + if (str != NULL && strlen (str) > 0) > + return nan.flt; > + return 0; > +} Same logic error. And this seems exactly same as nanq, the analogous is definitely wrong because __builtin_nanq should return a quiet NaN, but __builtin_nansq should return a signaling NaN. -- Xi Ruoyao <xry...@xry111.site> School of Aerospace Science and Technology, Xidian University