Re: Man page issues: logb, significand, cbrt, log2, log10, exp10

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Morten,

On Thu, Feb 29, 2024 at 07:28:10PM -0500, Morten Welinder wrote:
> I came across some minor issues in some math man pages.
> 
> M.

I'll reply to the others separately.

[...]

> exp10:
> The man page probably should come with a warning not to use the
> function for the time being.  The implementation is pretty bad.  For
> example, results for integer arguments 3, 4, 7, 8, 9, and 17 are
> needlessly inaccurate.


I can't reproduce that.

	alx@debian:~/tmp$ cat exp10.c 
	#define _GNU_SOURCE
	#include <math.h>
	#include <stdio.h>

	int
	main(void)
	{
		printf("exp10(17): %lf\n", exp10(17));
		printf("pow(10, 17): %lf\n", pow(10, 17));
	}
	alx@debian:~/tmp$ gcc -Wall -Wextra exp10.c -lm
	alx@debian:~/tmp$ ./a.out 
	exp10(17): 100000000000000000.000000
	pow(10, 17): 100000000000000000.000000

I'm running libc6 2.37-15.

> pow(10,x) is much better, but not perfect.


Have a lovely night!
Alex

-- 
<https://www.alejandro-colomar.es/>
Looking for a remote C programming job at the moment.

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux