OSDN Git Service

new
[ccunit/ccunit.git] / examples / complex / complex.h
1 /* -*- C -*- */
2 /* Copyright (C) 2003 TSUTSUMI Kikuo.
3    This file is part of the CCUnit Library.
4
5    The CCUnit Library is free software; you can redistribute it and/or
6    modify it under the terms of the GNU Lesser General Public License
7    as published by the Free Software Foundation; either version 2.1 of
8    the License, or (at your option) any later version.
9
10    The CCUnit Library is distributed in the hope that it will be
11    useful, but WITHOUT ANY WARRANTY; without even the implied warranty
12    of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13    GNU Lesser General Public License for more details.
14
15    You should have received a copy of the GNU Lesser General Public
16    License along with the CCUnit Library; see the file COPYING.LESSER.
17    If not, write to the Free Software Foundation, Inc., 59 Temple
18    Place - Suite 330, Boston, MA 02111-1307, USA.  
19 */
20
21 /*
22  * $Id$
23  */
24
25 #ifndef COMPLEX_H
26 #define COMPLEX_H
27
28 typedef struct complex_t
29 {
30   double real;
31   double imaginary;
32 } complex_t;
33
34 extern complex_t* complex_new (double real, double imaginary);
35 extern inline void complex_delete (const complex_t* cp);
36 extern char* complex_to_string (const complex_t* cp);
37 extern complex_t* complex_add (complex_t* z, const complex_t* x, const complex_t* y);
38 extern complex_t* complex_sub (complex_t* z, const complex_t* x, const complex_t* y);
39 extern complex_t* complex_mul (complex_t* z, const complex_t* x, const complex_t* y);
40 extern complex_t* complex_div (complex_t* z, const complex_t* x, const complex_t* y);
41 extern inline int complex_equals (const complex_t*x, const complex_t* y);
42
43 #endif  /* COMPLEX_H */