Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 01 Apr 2018 16:04:50 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-bugs@FreeBSD.org
Subject:   [Bug 227179] powl has lower than advertised precision
Message-ID:  <bug-227179-8@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D227179

            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@FreeBSD.org
          Reporter: yuri@freebsd.org
 Attachment #192060 text/plain
         mime type:

Created attachment 192060
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D192060&action=
=3Dedit
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.

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-227179-8>