public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug math/29326] New: Usage of double in sqrtf
@ 2022-07-07  7:58 stefan.arnold@aim-messtechnik.de
  0 siblings, 0 replies; only message in thread
From: stefan.arnold@aim-messtechnik.de @ 2022-07-07  7:58 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=29326

            Bug ID: 29326
           Summary: Usage of double in sqrtf
           Product: glibc
           Version: unspecified
            Status: UNCONFIRMED
          Severity: minor
          Priority: P2
         Component: math
          Assignee: unassigned at sourceware dot org
          Reporter: stefan.arnold@aim-messtechnik.de
  Target Milestone: ---

The function "__ieee754_sqrtf" in sysdeps/ieee754/flt-32/e_sqrtf.c has an
imlicit double conversion in lines 76 and 78. As this is quite useless and
costly especially on microcontrollers i suggest adding an "f" suffix to the
numbers.

--- a/sysdeps/ieee754/flt-32/e_sqrtf.c
+++ b/sysdeps/ieee754/flt-32/e_sqrtf.c
@@ -73,9 +73,9 @@ __ieee754_sqrtf(float x)
     /* use floating add to find out rounding direction */
        if(ix!=0) {
            z = 0x1p0 - 0x1.4484cp-100; /* trigger inexact flag.  */
-           if (z >= 0x1p0) {
+           if (z >= 0x1p0f) {
                z = 0x1p0 + 0x1.4484cp-100;
-               if (z > 0x1p0)
+               if (z > 0x1p0f)
                    q += 2;
                else
                    q += (q&1);
--

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-07-07  7:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-07  7:58 [Bug math/29326] New: Usage of double in sqrtf stefan.arnold@aim-messtechnik.de

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).