Summary: | [libm] Reduce diff between src/e_j0.c and src/e_j0f.c | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | Base System | Reporter: | sgk | ||||||
Component: | bin | Assignee: | freebsd-bugs (Nobody) <bugs> | ||||||
Status: | Closed FIXED | ||||||||
Severity: | Affects Only Me | CC: | pfg | ||||||
Priority: | --- | Keywords: | patch | ||||||
Version: | CURRENT | ||||||||
Hardware: | Any | ||||||||
OS: | Any | ||||||||
Attachments: |
|
Looking at the patch: --- src/e_j0f.c (revision 342861) +++ src/e_j0f.c (working copy) @@ -42,7 +42,7 @@ S03 = 5.1354652442e-07, /* 0x3509daa6 */ S04 = 1.1661400734e-09; /* 0x30a045e8 */ -static const float zero = 0.0; +static const float zero = 0, qrtr = 0.25; float __ieee754_j0f(float x) ... It is probably old school but I would prefer we still use 0.0 for float. Created attachment 200917 [details]
Use literal constants
Small variation of the patch, using 0.0 and 1.0 where pertinent.
Comment on attachment 200917 [details]
Use literal constants
According to bde@:
It's silly to use 0.0 for float in some contexts when the main point of
the patch is to use integer constants that will be converted to float
instead of explicit float constants. 0.0 isn't even a float constant,
but is converted to one before assignment to a float variable.
Also, static initialization to any type of 0 is redundant.
A commit references this bug: Author: pfg Date: Mon Jan 14 15:48:35 UTC 2019 New revision: 343023 URL: https://svnweb.freebsd.org/changeset/base/343023 Log: msun: reduce diff between src/e_j0.c and src/e_j0f.c PR: 229501 MFC after: 1 week Changes: head/lib/msun/src/e_j0.c head/lib/msun/src/e_j0f.c A commit references this bug: Author: pfg Date: Mon Jan 21 14:52:49 UTC 2019 New revision: 343256 URL: https://svnweb.freebsd.org/changeset/base/343256 Log: MFC r343023: msun: reduce diff between src/e_j0.c and src/e_j0f.c PR: 229501 Changes: _U stable/12/ stable/12/lib/msun/src/e_j0.c stable/12/lib/msun/src/e_j0f.c A commit references this bug: Author: pfg Date: Mon Jan 21 14:54:01 UTC 2019 New revision: 343257 URL: https://svnweb.freebsd.org/changeset/base/343257 Log: MFC r343023: msun: reduce diff between src/e_j0.c and src/e_j0f.c PR: 229501 Changes: _U stable/11/ stable/11/lib/msun/src/e_j0.c stable/11/lib/msun/src/e_j0f.c A commit references this bug: Author: pfg Date: Mon Jan 21 14:55:10 UTC 2019 New revision: 343258 URL: https://svnweb.freebsd.org/changeset/base/343258 Log: MFC r343023: msun: reduce diff between src/e_j0.c and src/e_j0f.c PR: 229501 Changes: _U stable/10/ stable/10/lib/msun/src/e_j0.c stable/10/lib/msun/src/e_j0f.c Committed, thanks ! |
Created attachment 194865 [details] Use literal constants The attached diff reduces the diff between src/e_j0.c and src/e_j0f.c. Specifically, where possible it uses literal integer constants to remove the need for casting a double literal constant to a float, and it introduces 'static const <type> qrtr = 0.25' and 'static const <type> eighth = 0.125' to eliminate the need for casting doubles to floats. Exhaustive testing of j0f(x) in the domain [0,1e+30) shows no differences. While here convert a sentence fragment in a comment to a sentence.