[libc-commits] [PATCH] D117590: [libc] Implement correct rounding with all rounding modes for hypot functions.

Paul Zimmermann via Phabricator via libc-commits libc-commits at lists.llvm.org
Thu Jan 20 07:31:45 PST 2022


zimmermann6 accepted this revision.
zimmermann6 added a comment.
This revision is now accepted and ready to land.

I'm ok with the new revision. However I see there are still some calls to get_round(). Did you try to replace them by floating-point operations?

You might also want to add the following hard-to-round cases (for binary32) in your test cases:

  /* the following are hard-to-round cases with many identical bits after       
     the round bit */
  {0x1.900004p+34,0x1.400002p+23}, /* 45 identical bits */
  {0x1.05555p+34,0x1.bffffep+23},  /* 44 identical bits */
  {0x1.e5fffap+34,0x1.affffep+23}, /* 45 identical bits */
  {0x1.260002p+34,0x1.500002p+23}, /* 45 identical bits */
  {0x1.fffffap+34,0x1.fffffep+23}, /* 45 identical bits */
  {0x1.8ffffap+34,0x1.3ffffep+23}, /* 45 identical bits */
  {0x1.87fffcp+35,0x1.bffffep+23}, /* 47 identical bits */

By the way, none of the other libraries is correctly rounded for binary32, here are the corresponding worst cases:

  /* hypot(x,y) */
  {0x1.b8e50ap-52,-0x1.db1e78p-64},   /* GNU libc       0.500001 */
  {0x1.03b54cp-33,0x1.6ca6bep-45},    /* icc            0.500001 */
  {0x1.e2eff6p+97,-0x1.044cb2p+108},  /* AMD LibM       0.500001 */
  {-0x1.6b05c4p-127,0x1.6b3146p-126}, /* Newlib         1.20805 */
  {-0x1.6b05c4p-127,0x1.6b3146p-126}, /* OpenLibm       1.20805 */
  {0x1.26b188p-127,-0x1.a4f2fp-128},  /* Musl           0.926707 */
  {0x1.e2eff6p+97,-0x1.044cb2p+108},  /* Darwin 20.4.0  0.500001 */


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D117590/new/

https://reviews.llvm.org/D117590



More information about the libc-commits mailing list