xiaoxiang781216 commented on code in PR #7025:
URL: https://github.com/apache/incubator-nuttx/pull/7025#discussion_r964353029


##########
libs/libc/math/lib_roundl.c:
##########
@@ -34,6 +34,9 @@
 #ifdef CONFIG_HAVE_LONG_DOUBLE
 long double roundl(long double x)
 {
+  if (isinf(x) || isnan(x))

Review Comment:
   > If you are using `gcc` you can use `__builtin_infl()`, `__builtin_inf()`, 
`__builtin_inff()`, `__builtin_nanl("")`, `__builtin_nan("")`, and 
`__builtin_nanf("")`.
   >
   
   common code can't use gcc special macro.
    
   > However, reusing `INFINITY` and `NAN` for long doubles is fine from a 
value perspective.
   
   No, INFINITY for double may be different(e.g. x86 has 80bit long double, 
64bit double) from long double. You have to define:
   ```
   #define INFINITY_L  (1.0F/0.0L)
   #define NAN_L       (0.0F/0.0L)
   ```
   and use these in isinfl/isnanf.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to