Skip to Content
Cクイックリファレンス 第2版
book

Cクイックリファレンス 第2版

by Peter Prinz, Tony Crawford, 黒川 利明, 島 敏博
November 2016
Beginner to intermediate
816 pages
19h 58m
Japanese
O'Reilly Japan, Inc.
Content preview from Cクイックリファレンス 第2版
3.3
 文字定数
37
3.2.2
16
進浮動小数点定数
C99標準は16進浮動小数点定数を導入した。10進浮動小数点定数と比べて次のような利
点がある。16進で定数値を指定すると、コンピュータの2進浮動小数点形式に正確に丸め
誤差なしに格納できる。10進表記の「丸めた数」値だと、0.1のような値の場合、2進では小
数部が割り切れず内部形式では丸めざるを得ない(浮動小数点数の丸め例は例2-2参照)。
16進浮動小数点定数は、語頭の
0x
または
0X
、小数点(「16進小数点」と呼ぶべき)を含ん
でよい16進数字列、2を底とする指数からなる。指数は
p
または
P
から始まると10進数で
ある。例えば、定数
0xa.fP-10
10進数の (1015/16)×2
10
2
16
ではない)と等しい。
同じ定数値で表記される等価なものには、
0xA.Fp-10
,
0x5.78p-9
,
0xAFp-14
,
0x.02BCp0
があ
る。指数が1違うと
2倍または半分、16進小数点が1桁ずれると16倍または1/16になる。
16進浮動小数点定数では、たとえ値が 0でも指数を追加する。これは、(指数の後の)型
の語末
F
を(指数の左の)16進数字
F
と区別するために必要となる。例えば、指数がないと、
定数
0x1.0F
は、型
float
の数1.0かデフォルト型
double
の数115/256かわからない。
10進浮動小数点定数同様、16進浮動小数点定数はデフォルト型
double
である。語末に
F
または
f
で型
float
、語末に
L
または
l
で型
long ...
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

Rustの練習帳 ―コマンドラインツールの作成を通してRustを学ぶ

Rustの練習帳 ―コマンドラインツールの作成を通してRustを学ぶ

Ken Youens-Clark, 中山 光樹
Unityによるモバイルゲーム開発 ―作りながら学ぶ2D/3Dゲームプログラミング入門

Unityによるモバイルゲーム開発 ―作りながら学ぶ2D/3Dゲームプログラミング入門

Jon Manning, Paris Buttfield-Addison, 鈴木 久貴, あんどうやすし, 江川 崇, 安藤 幸央, 高橋 憲一

Publisher Resources

ISBN: 9784873117812Other