Skip to Content
C语言核心技术(原书第2版)
book

C语言核心技术(原书第2版)

by Peter Prinz, Tony Crawford
August 2017
Intermediate to advanced
798 pages
17h 44m
Chinese
China Machine Press
Content preview from C语言核心技术(原书第2版)
38
|
第
2
章
在这个例子中,最接近
12345.6
的表示值是
12345.5996093750
。虽然从十进制来看,这
不像一个约整值,但是计算机内部,在二进制表示方法中,它可以被精确表示出来,而
12345.60
则无法被精确地表示出来。
2.4 复数浮点类型
C99
支持复数数学计算。
1999
年标准增加了复数浮点类型,并扩充了数学库以包括复数
算术函数。这些函数均声明在头文件
complex.h
中,包括有三角函数
csin()
、
ctan()
等
(请参见第
16
章)。
在
C11
标准中,对复数的支持是可选的。通过定义宏
__STDC_NO_COMPLEX__
,来指明所采
用的实现版本未包括头文件
complex.h
。
在笛卡儿坐标中,复数
z
可被表示为
z
=
x
+
y
×
i
,其中
x
和
y
是实数,
i
是虚数单位
(
imaginary unit
),其定义为
i
2
=
-
1
。
x
被称为
z
的实部,
y
被称为
z
的虚部。
在
C
语言中,复数被表示成一对浮点数,这一对浮点数分别是实部和虚部。两者的数据
类型一样,可以是
float
、
double
或
long double
。相应地,有三种复数浮点类型:
•
float _Complex
•
double _Complex
•
long double _Complex
上述数据类型每组中的实部与虚部都具有相同的空间大小和对齐方式,可以将上述三种
数据类型看成三个数组,每个数组具有两个
float
、
double
或
long double
元素。
头文件
complex.h
定义了宏
complex
和
I
。宏
complex
是关键字
_Complex
的同义词。宏 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

算法精讲视频课程:24篇系列讲座

算法精讲视频课程:24篇系列讲座

罗伯特·塞奇威克, 凯文·韦恩(Kevin Wayne)

Publisher Resources

ISBN: 9787111562207