You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/09/07 02:46:26 UTC

[GitHub] [incubator-nuttx] nealef commented on a diff in pull request #7025: Add check in roundx() functions for infinite or NaN cases

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


##########
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:
   There doesn't appear to be one and I am not sure it is required. `isinf()` and `isnan()` are defined in `math.h`:
   ```
   #define INFINITY    (1.0/0.0)
   #define NAN         (0.0/0.0)
   :
   :
   #define isnan(x)    ((x) != (x))
   #define isinf(x)    (((x) == INFINITY) || ((x) == -INFINITY))
   #define isfinite(x) (!(isinf(x) || isnan(x)))
   ```
   It would appear using the same definition as `double` is fine.



-- 
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-unsubscribe@nuttx.apache.org

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