From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8350 invoked by alias); 2 May 2014 20:45:30 -0000 Mailing-List: contact glibc-bugs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: glibc-bugs-owner@sourceware.org Received: (qmail 8338 invoked by uid 89); 2 May 2014 20:45:30 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 X-HELO: www84.your-server.de Received: from www84.your-server.de (HELO www84.your-server.de) (213.133.104.84) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 02 May 2014 20:45:28 +0000 Received: from [178.26.77.31] (helo=[192.168.0.3]) by www84.your-server.de with esmtpsa (SSLv3:DHE-RSA-AES256-SHA:256) (Exim 4.80.1) (envelope-from ) id 1WgKKj-0003or-Fe for glibc-bugs@sourceware.org; Fri, 02 May 2014 22:45:25 +0200 Message-ID: <1399063459.1910.33.camel@vger.seibold.net> Subject: [Bug libm] pow() function execution time increase by factor 4000 From: Stefani Seibold To: glibc-bugs@sourceware.org Date: Fri, 02 May 2014 20:45:00 -0000 Content-Type: text/plain; charset="us-ascii" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-SW-Source: 2014-05/txt/msg00025.txt.bz2 A pow(10.0, x) where x has the hex equivalent of 0xc022247c7a9c48f9l needs 4000 times longer as x equal 0xc022247c7a9c4800l, which is nearly the same value. This happens on x86_64 Linux. I have tested it with the current git tree and GLIB 2.19, but the behavior can also reproduced on an old EGLIBC 2.12 32 bit PowerPC Linux system. The origin the fdlibm pow() function does not show this performance impact, but is nearly three times slower as the best case libm execution time. The result of the function call are the same. As i figured out the value 0xc022247c7a9c48f9l run into the __slowpow() branch, where 0xc022247c7a9c4800l does bypass this branch. A "perf stat -e instructions" show that the 0xc022247c7a9c48f9 value needs round about 1505962 instructions, the 0xc022247c7a9c4800l needs only 385 instructions. On the old PowerPC device the execution time is 1 us vs. 5000 us. This makes pow() not very useable in a realtime environment. Maybe the exp() has the same problem. - Stefani