1*e3a78b6cSrobert /* $OpenBSD: exp.c,v 1.3 2017/08/06 20:31:58 robert Exp $ */
221a1d549Sotto
321a1d549Sotto /* Written by Otto Moerbeek, 2006, Public domain. */
421a1d549Sotto
521a1d549Sotto #include <math.h>
621a1d549Sotto #include <err.h>
721a1d549Sotto
821a1d549Sotto int
main(void)921a1d549Sotto main(void)
1021a1d549Sotto {
1121a1d549Sotto double rd, bigd = HUGE_VAL;
12ca90fc32Smartynas float rf, bigf = HUGE_VALF;
13ca90fc32Smartynas long double rl, bigl = HUGE_VALL;
1421a1d549Sotto
1521a1d549Sotto rd = exp(bigd);
1621a1d549Sotto if (!isinf(rd))
1721a1d549Sotto errx(1, "exp(bigd) = %f", rd);
1821a1d549Sotto rd = exp(-bigd);
1921a1d549Sotto if (rd != 0.0)
2021a1d549Sotto errx(1, "exp(-bigd) = %f", rd);
2121a1d549Sotto
2221a1d549Sotto rf = expf(bigf);
23ca90fc32Smartynas if (!isinf(rf))
2421a1d549Sotto errx(1, "exp(bigf) = %f", rf);
2521a1d549Sotto rf = expf(-bigf);
2621a1d549Sotto if (rf != 0.0F)
2721a1d549Sotto errx(1, "exp(-bigf) = %f", rf);
28ca90fc32Smartynas
29ca90fc32Smartynas rl = expl(bigl);
30ca90fc32Smartynas if (!isinf(rl))
31*e3a78b6cSrobert errx(1, "exp(bigl) = %Lf", rl);
32ca90fc32Smartynas rl = expl(-bigl);
33ca90fc32Smartynas if (rl != 0.0L)
34*e3a78b6cSrobert errx(1, "exp(-bigl) = %Lf", rl);
35ca90fc32Smartynas
3621a1d549Sotto return (0);
3721a1d549Sotto }
38