Openwall GNU/*/Linux - a small security-enhanced Linux distro for servers
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 6 Feb 2020 23:08:34 +0100
From: Szabolcs Nagy <nsz@...t70.net>
To: musl@...ts.openwall.com
Subject: Re: Q: dealing with missing removal of excess precision

* Rich Felker <dalias@...c.org> [2020-02-06 15:02:58 -0500]:
> #include <math.h>
> 
> int main()
> {
> 	double x, a=0;
> 	for (x=-2; x<2; x+=0x1p-24)
> 		a += exp(x);
> 	return (long long)a;
> }

same here on my old core i5 x86_64 laptop

asm: 3.13s
c  : 2.67s

optimized-routines benchmark is

asm:
      exp rthruput:   44.18 ns/elem   44176510 ns in [-9.9 9.9]
      exp  latency:   48.32 ns/call   48317455 ns in [-9.9 9.9]
     expf rthruput:   28.59 ns/elem   28586714 ns in [-9.9 9.9]
     expf  latency:   44.54 ns/call   44536368 ns in [-9.9 9.9]
     exp2 rthruput:   42.63 ns/elem   42634692 ns in [-9.9 9.9]
     exp2  latency:   46.54 ns/call   46543915 ns in [-9.9 9.9]
    exp2f rthruput:   27.75 ns/elem   27751888 ns in [-9.9 9.9]
    exp2f  latency:   42.91 ns/call   42908855 ns in [-9.9 9.9]
c:
      exp rthruput:   34.74 ns/elem   34735750 ns in [-9.9 9.9]
      exp  latency:   38.88 ns/call   38879834 ns in [-9.9 9.9]
     expf rthruput:   14.88 ns/elem   14878824 ns in [-9.9 9.9]
     expf  latency:   26.74 ns/call   26740464 ns in [-9.9 9.9]
     exp2 rthruput:   31.62 ns/elem   31622777 ns in [-9.9 9.9]
     exp2  latency:   35.76 ns/call   35760590 ns in [-9.9 9.9]
    exp2f rthruput:   14.87 ns/elem   14869128 ns in [-9.9 9.9]
    exp2f  latency:   24.80 ns/call   24795727 ns in [-9.9 9.9]

Powered by blists - more mailing lists

Your e-mail address:

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.