File: complex.c

package info (click to toggle)
gcc-sh-elf 8.3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 140 kB
  • sloc: ansic: 237; makefile: 93; sh: 54
file content (20 lines) | stat: -rw-r--r-- 454 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#define _XOPEN_SOURCE 700
#include <assert.h>
#include <errno.h>
#include <float.h>
#include <stdio.h>
#include <stdlib.h>
#include <tgmath.h>

int main(void) {
	/* Newlib seems to handle Euler's identity with very high precision. */
	double g = cabs(cexp(2 * M_PI * I) - 1.0);
	static_assert(math_errhandling & MATH_ERRNO, "math errors are not indicated via errno");
	if(errno) {
		perror(NULL);
		abort();
	}
	if(g > 2 * DBL_EPSILON) {
		abort();
	}
}