This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH v2] Don't do double divide in powf.


Updated patch to use 0.0f/0.0f to avoid the divdf3 call.

Tested same way as before, with a testcase that triggers the code and
make check.

OK?

	newlib/
	* libm/math/wf_pow.c (powf): Use 0.0f instead 0.0 in divide.
---
 newlib/libm/math/wf_pow.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/newlib/libm/math/wf_pow.c b/newlib/libm/math/wf_pow.c
index be453558b..7f4c6b651 100644
--- a/newlib/libm/math/wf_pow.c
+++ b/newlib/libm/math/wf_pow.c
@@ -108,7 +108,9 @@
 		    if (_LIB_VERSION == _SVID_) 
 		        exc.retval = 0.0;
 		    else 
-		        exc.retval = 0.0/0.0;	/* X/Open allow NaN */
+		        /* Use a float divide, to avoid a soft-float double
+			   divide call on single-float only targets.  */
+		        exc.retval = (0.0f/0.0f);	/* X/Open allow NaN */
 		    if (_LIB_VERSION == _POSIX_) 
 		        errno = EDOM;
 		    else if (!matherr(&exc)) {
-- 
2.14.1


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]