复数和printf [英] Complex numbers and printf

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

问题描述

C99标准忘了定义复杂数字的printf等价物

因为我正在修改复数的lcc-win实现

我决定填补这个漏洞

" Z"


例如

double _Complex m = 2 + 3 * I;

printf("%Zg \ n",m);

将打印

2 + 3 *我


替代标志使其看起来像:


printf("%#Zg \ n",m);

2.00000 + 3.00000i


-

jacob navia

jacob at jacob point remcomp point fr

logiciels / informatique
http://www.cs.virginia.edu/~lcc- win32

The C99 standard forgot to define the printf equivalent for complex numbers
Since I am revising the lcc-win implementation of complex numbers
I decided to fill this hole with
"Z"

for instance
double _Complex m = 2+3*I;
printf("%Zg\n",m);
will print
2+3*I

The alternative flag makes this look like:

printf("%#Zg\n",m);
2.00000+3.00000i

--
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique
http://www.cs.virginia.edu/~lcc-win32

推荐答案



" jacob navia" < ja *** @ nospam.com写信息

新闻:fq ********** @ aioe.org ...

"jacob navia" <ja***@nospam.comwrote in message
news:fq**********@aioe.org...

C99标准忘了定义复杂的printf等价物

数字


因为我正在修改复数的lcc-win实现

我决定用

填充这个洞Z


例如

double _Complex m = 2 + 3 * I;

printf("%Zg \ nn,m);

将打印

2 + 3 *我


替代标志使其看起来像:


printf("%#Zg \ n",m) ;

2.00000 + 3.00000i
The C99 standard forgot to define the printf equivalent for complex
numbers
Since I am revising the lcc-win implementation of complex numbers
I decided to fill this hole with
"Z"

for instance
double _Complex m = 2+3*I;
printf("%Zg\n",m);
will print
2+3*I

The alternative flag makes this look like:

printf("%#Zg\n",m);
2.00000+3.00000i



我不认为这就像那样,雅各布,就像晚餐我一样在Champs d'Elyzee上摄取了
。不同于那些6名厨师2名模具师,他们知道给我带来优质美食,而他们给我喂了一匹马,我要么给我的衬衫口袋或者给我b $ b。在返回酒店途中的人行道上,我实际上预计会吃一顿饭。


我有兴趣尝试新版本的lcc 。


-

Gerry Ford


" Er hat sich georgiert。 Der Spiegel,2008,sich auf Chimpy Eins komma null

beziehend。

I don''t think it''s quite like that, Jacob, much like the dinner I ingested
on the Champs d''Elyzee. Unlike those 6 chefs 2 dieners, who knew to feed my
wife excellent cuisine while they fed me a horse''s willy that I either gave
to my shirt pocket or to the sidewalk on our way back to the hotel, I
actually expected a meal.

I''d be interested to try a new version of lcc.

--
Gerry Ford

"Er hat sich georgiert." Der Spiegel, 2008, sich auf Chimpy Eins komma null
beziehend.


文章< 12 ********* *****@news.newsgroups.com> ;,Gerry Ford < in ***** @ invalid.netwrote:
In article <12**************@news.newsgroups.com>, "Gerry Ford" <in*****@invalid.netwrote:

>我不认为它就像那样,Jacob,很像晚餐我在香榭丽舍大街上摄取了。不同于那些6名厨师2名模具师,他们知道给我的妻子提供美味的菜肴,而他们给我喂了一匹马,我要么把它给了我的衬衫口袋,要么在我回去的路上给人行道酒店,我实际上期待一顿饭。
>I don''t think it''s quite like that, Jacob, much like the dinner I ingested
on the Champs d''Elyzee. Unlike those 6 chefs 2 dieners, who knew to feed my
wife excellent cuisine while they fed me a horse''s willy that I either gave
to my shirt pocket or to the sidewalk on our way back to the hotel, I
actually expected a meal.



将来,请在发布前清醒。谢谢。

In future, please sober up before posting. Thank you.


Gerry Ford写道:


[糟糕的晚餐留下了持久的印象]


回到复杂的数字...任何评论?


-

jacob navia

jacob雅各布point remcomp point fr

logiciels / informatique
http://www.cs.virginia.edu/~lcc-win32
Gerry Ford wrote:

[bad dinner left a lasting impression]

Coming back to complex numbers... Any comments?

--
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique
http://www.cs.virginia.edu/~lcc-win32


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

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