"%.7le" 是什么意思在 printf 中是什么意思? [英] What does "%.7le " in printf means?

查看:105
本文介绍了"%.7le" 是什么意思在 printf 中是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

做什么

fprintf(fp, "%.7le ", data);

是什么意思?

我不知道什么是%.7le"是意思.

I don't know what "%.7le " is mean.

谢谢!

推荐答案

.7 是精度,le 是范式.

double x = 0.012345678910;
printf("%.7lf\n", x);  // 0.0123457
printf("%.7le\n", x);  // 1.2345679e-02
printf("%.9le\n", x);  // 1.234567891e-02

编辑请参阅下面的 Eric Postpischil 的答案,它比这个更全面.

Edit See Eric Postpischil's unswer below, it's way more comprehensive than this one.

这篇关于"%.7le" 是什么意思在 printf 中是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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