[Bug 227179] powl has lower than advertised precision

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Sun Apr 1 16:04:52 UTC 2018


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=227179

            Bug ID: 227179
           Summary: powl has lower than advertised precision
           Product: Base System
           Version: 11.0-STABLE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: misc
          Assignee: freebsd-bugs at FreeBSD.org
          Reporter: yuri at freebsd.org
 Attachment #192060 text/plain
         mime type:

Created attachment 192060
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=192060&action=edit
pow.cc

powl produces inaccurate results.

The attached program prints different results, depending on it using powl or
not.

In the unoptimized case, it used powl:
> $ c++ -o pow pow.cc  && pow
> /tmp/pow-a03910.o: In function `main':
> pow.cc:(.text+0x5b): warning: powl has lower than advertised precision
> pow(integer{2}, 4.5l) -> 22.627416997969518774880270939320
> std::pow(2.l, 4.5l) -> 22.627416997969518774880270939320

In the optimized case, powl is pre-computed by the compiler:
> $ c++ -O3 -o pow pow.cc  && pow
> pow(integer{2}, 4.5l) -> 22.627416997969520780220609168509
> std::pow(2.l, 4.5l) -> 22.627416997969520780220609168509

The results are different.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list