C99中的复杂算术 [英] complex arithmetic in C99

查看:76
本文介绍了C99中的复杂算术的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以给我看一下或者给我一个声明和/或
来初始化C99复数的例子吗?另外,在查看

complex.h时,我没有看到任何库调用+ - *或/。

如何进行基本的算术运算?

David Marsh

解决方案

< blockquote> David Marsh写道:


有人可以给我看一下或者给我一个声明和

初始化C99复数的例子吗?另外,在查看complex.h时,我没有看到任何库调用+ - *或/。如何执行基本算术

操作?

David Marsh



#include< ; complex.h>

int main(无效)

{

复数c = 1.2 + 0.67 *我;

}


这定义了复数1.2 + 0.67i。




David Marsh写道:


有人可以给我看一下或者给我一个声明和

初始化C99复数的例子吗?另外,在查看

complex.h时,我没有看到任何库调用+ - *或/。

如何进行基本的算术运算?
David Marsh



ISO / IEC 9899:1999(E)?ISO / IEC

第128页语言§6.7.8

24示例1如果< complex.h已被#included,则

声明

int i = 3.5;

复数c = 5 + 3 * I;

定义并初始化我值3和c的值为5.0 +

i3.0。




" ; jacob navia" < ja *** @ jacob.remcomp.frwrote in message

news:45 *********************** @ news .orange.fr ...


David Marsh写道:


>有人可以给我看或者请给我举一个在C99中声明和初始化复数的例子?另外,在查看complex.h时,我没有看到任何库调用+ - *或/。如何进行基本的算术运算?

David Marsh



#include< complex.h>

int main(无效)

{

复数c = 1.2 + 0.67 *我;

}


这定义了复数1.2 + 0.67i。



浮_Complex,double _Complex和long double _Complex有效ISO C

类型? LS


Can someone show me or point me to an example of declaring and
initializing complex numbers in C99? Also, in looking at
complex.h, I don''t see any library calls for + - * or /. How are
the basic arithmetic operations carried out?

David Marsh

解决方案

David Marsh wrote:

Can someone show me or point me to an example of declaring and
initializing complex numbers in C99? Also, in looking at complex.h, I
don''t see any library calls for + - * or /. How are the basic arithmetic
operations carried out?

David Marsh

#include <complex.h>
int main(void)
{
complex c = 1.2+0.67*I;
}

This defines the complex number 1.2+0.67i.



David Marsh wrote:

Can someone show me or point me to an example of declaring and
initializing complex numbers in C99? Also, in looking at
complex.h, I don''t see any library calls for + - * or /. How are
the basic arithmetic operations carried out?

David Marsh

ISO/IEC 9899:1999 (E) ?ISO/IEC
page 128 Language §6.7.8
24 EXAMPLE 1 Provided that <complex.hhas been #included, the
declarations
int i = 3.5;
complex c = 5 + 3 * I;
define and initialize i with the value 3 and c with the value 5.0 +
i3.0.



"jacob navia" <ja***@jacob.remcomp.frwrote in message
news:45***********************@news.orange.fr...

David Marsh wrote:

>Can someone show me or point me to an example of declaring and
initializing complex numbers in C99? Also, in looking at complex.h, I
don''t see any library calls for + - * or /. How are the basic arithmetic
operations carried out?

David Marsh


#include <complex.h>
int main(void)
{
complex c = 1.2+0.67*I;
}

This defines the complex number 1.2+0.67i.

Are float _Complex , double _Complex and long double _Complex valid ISO C
types? LS


这篇关于C99中的复杂算术的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆