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 2020/10/23 10:01:44 UTC

[GitHub] [incubator-nuttx] yamt opened a new pull request #2076: math: Make this friendly with libcxx

yamt opened a new pull request #2076:
URL: https://github.com/apache/incubator-nuttx/pull/2076


   - Turn some macros into functions
   
   - Implement some type-agnostic functions.
     (Just use __builtin_xxx)
   
   - Add some missing function prototypes
     (Just prototypes, not actually implemented in this commit)
   
   ## Summary
   
   ## Impact
   
   ## Testing
   
   


----------------------------------------------------------------
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.

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



[GitHub] [incubator-nuttx] xiaoxiang781216 merged pull request #2076: math: Make this friendly with libcxx

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 merged pull request #2076:
URL: https://github.com/apache/incubator-nuttx/pull/2076


   


----------------------------------------------------------------
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.

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



[GitHub] [incubator-nuttx] yamt commented on a change in pull request #2076: math: Make this friendly with libcxx

Posted by GitBox <gi...@apache.org>.
yamt commented on a change in pull request #2076:
URL: https://github.com/apache/incubator-nuttx/pull/2076#discussion_r511544472



##########
File path: include/nuttx/lib/math.h
##########
@@ -233,22 +251,77 @@ long double powl  (long double b, long double e);
 #endif
 
 float       expf  (float x);
-#define expm1f(x) (expf(x) - 1.0)
+float       exp2f (float x);
+float       expm1f(float x);
 #ifdef CONFIG_HAVE_DOUBLE
 double      exp   (double x);
-#define expm1(x) (exp(x) - 1.0)
+double      exp2  (double x);
+double      expm1 (double x);
 #endif
 #ifdef CONFIG_HAVE_LONG_DOUBLE
 long double expl  (long double x);
-#define expm1l(x) (expl(x) - 1.0)
+long double exp2l (long double x);
+long double expm1l(long double x);
 #endif
 
+float       fdimf(float x, float y);
+#ifdef CONFIG_HAVE_DOUBLE
+double      fdim(double x, double y);
+#endif
+#ifdef CONFIG_HAVE_LONG_DOUBLE
+long double fdiml(long double x, long double y);
+#endif
+
+float       fmaf(float x, float y, float z);
+#ifdef CONFIG_HAVE_DOUBLE
+double      fma(double x, double y, double z);
+#endif
+#ifdef CONFIG_HAVE_LONG_DOUBLE
+long double fmal(long double x, long double y, long double z);
+#endif
+
+float       fmaxf(float x, float y);
+#ifdef CONFIG_HAVE_DOUBLE
+double      fmax(double x, double y);
+#endif
+#ifdef CONFIG_HAVE_LONG_DOUBLE
+long double fmaxl(long double x, long double y);
+#endif
+
+float       fminf(float x, float y);
+#ifdef CONFIG_HAVE_DOUBLE
+double      fmin(double x, double y);
+#endif
+#ifdef CONFIG_HAVE_LONG_DOUBLE
+long double fminl(long double x, long double y);
+#endif
+
+float       hypotf(float x, float y);
+#ifdef CONFIG_HAVE_DOUBLE
+double      hypot(double x, double y);
+#endif
+#ifdef CONFIG_HAVE_LONG_DOUBLE
+long double hypotl(long double x, long double y);

Review comment:
       right. as explained in the commit message.




----------------------------------------------------------------
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.

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



[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #2076: math: Make this friendly with libcxx

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #2076:
URL: https://github.com/apache/incubator-nuttx/pull/2076#discussion_r511288220



##########
File path: include/nuttx/lib/math.h
##########
@@ -233,22 +251,77 @@ long double powl  (long double b, long double e);
 #endif
 
 float       expf  (float x);
-#define expm1f(x) (expf(x) - 1.0)
+float       exp2f (float x);
+float       expm1f(float x);
 #ifdef CONFIG_HAVE_DOUBLE
 double      exp   (double x);
-#define expm1(x) (exp(x) - 1.0)
+double      exp2  (double x);
+double      expm1 (double x);
 #endif
 #ifdef CONFIG_HAVE_LONG_DOUBLE
 long double expl  (long double x);
-#define expm1l(x) (expl(x) - 1.0)
+long double exp2l (long double x);
+long double expm1l(long double x);
 #endif
 
+float       fdimf(float x, float y);
+#ifdef CONFIG_HAVE_DOUBLE
+double      fdim(double x, double y);
+#endif
+#ifdef CONFIG_HAVE_LONG_DOUBLE
+long double fdiml(long double x, long double y);
+#endif
+
+float       fmaf(float x, float y, float z);
+#ifdef CONFIG_HAVE_DOUBLE
+double      fma(double x, double y, double z);
+#endif
+#ifdef CONFIG_HAVE_LONG_DOUBLE
+long double fmal(long double x, long double y, long double z);
+#endif
+
+float       fmaxf(float x, float y);
+#ifdef CONFIG_HAVE_DOUBLE
+double      fmax(double x, double y);
+#endif
+#ifdef CONFIG_HAVE_LONG_DOUBLE
+long double fmaxl(long double x, long double y);
+#endif
+
+float       fminf(float x, float y);
+#ifdef CONFIG_HAVE_DOUBLE
+double      fmin(double x, double y);
+#endif
+#ifdef CONFIG_HAVE_LONG_DOUBLE
+long double fminl(long double x, long double y);
+#endif
+
+float       hypotf(float x, float y);
+#ifdef CONFIG_HAVE_DOUBLE
+double      hypot(double x, double y);
+#endif
+#ifdef CONFIG_HAVE_LONG_DOUBLE
+long double hypotl(long double x, long double y);

Review comment:
       Many new added function don't have the implementation?




----------------------------------------------------------------
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.

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



[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #2076: math: Make this friendly with libcxx

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #2076:
URL: https://github.com/apache/incubator-nuttx/pull/2076#discussion_r511604252



##########
File path: include/nuttx/lib/math.h
##########
@@ -233,22 +251,77 @@ long double powl  (long double b, long double e);
 #endif
 
 float       expf  (float x);
-#define expm1f(x) (expf(x) - 1.0)
+float       exp2f (float x);
+float       expm1f(float x);
 #ifdef CONFIG_HAVE_DOUBLE
 double      exp   (double x);
-#define expm1(x) (exp(x) - 1.0)
+double      exp2  (double x);
+double      expm1 (double x);
 #endif
 #ifdef CONFIG_HAVE_LONG_DOUBLE
 long double expl  (long double x);
-#define expm1l(x) (expl(x) - 1.0)
+long double exp2l (long double x);
+long double expm1l(long double x);
 #endif
 
+float       fdimf(float x, float y);
+#ifdef CONFIG_HAVE_DOUBLE
+double      fdim(double x, double y);
+#endif
+#ifdef CONFIG_HAVE_LONG_DOUBLE
+long double fdiml(long double x, long double y);
+#endif
+
+float       fmaf(float x, float y, float z);
+#ifdef CONFIG_HAVE_DOUBLE
+double      fma(double x, double y, double z);
+#endif
+#ifdef CONFIG_HAVE_LONG_DOUBLE
+long double fmal(long double x, long double y, long double z);
+#endif
+
+float       fmaxf(float x, float y);
+#ifdef CONFIG_HAVE_DOUBLE
+double      fmax(double x, double y);
+#endif
+#ifdef CONFIG_HAVE_LONG_DOUBLE
+long double fmaxl(long double x, long double y);
+#endif
+
+float       fminf(float x, float y);
+#ifdef CONFIG_HAVE_DOUBLE
+double      fmin(double x, double y);
+#endif
+#ifdef CONFIG_HAVE_LONG_DOUBLE
+long double fminl(long double x, long double y);
+#endif
+
+float       hypotf(float x, float y);
+#ifdef CONFIG_HAVE_DOUBLE
+double      hypot(double x, double y);
+#endif
+#ifdef CONFIG_HAVE_LONG_DOUBLE
+long double hypotl(long double x, long double y);

Review comment:
       Ok, let's merge it. Anyway, the linker will fail if the function is really used.




----------------------------------------------------------------
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.

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