1 // Copyright 2010 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
5 // gcc '-std=c99' cmplxdivide.c && a.out >cmplxdivide1.go
12 #define nelem(x) (sizeof(x)/sizeof((x)[0]))
27 static char buf[10][30];
35 if(strcmp(p, "-0") == 0)
44 double complex n, d, q;
46 printf("// # generated by cmplxdivide.c\n");
48 printf("package main\n");
49 printf("var tests = []Test{\n");
50 for(i=0; i<nelem(f); i++)
51 for(j=0; j<nelem(f); j++)
52 for(k=0; k<nelem(f); k++)
53 for(l=0; l<nelem(f); l++) {
57 printf("\tTest{cmplx(%s, %s), cmplx(%s, %s), cmplx(%s, %s)},\n", fmt(creal(n)), fmt(cimag(n)), fmt(creal(d)), fmt(cimag(d)), fmt(creal(q)), fmt(cimag(q)));