本文介绍了e的语法(自然日志)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道,如果有一个,那么常量e

的语法是什么。我认为它会在math.h中与''pi''一起出现,但它并不是b $ b似乎在那里,它确实存在吗?我在网上进行了很多搜索,但它很难搜索字母e,甚至尝试过自然日志,但是出现了

干。任何帮助将不胜感激,谢谢!


~Senturon

I was wondering what, if there is even one, the syntax for the constant e
is. I figured it would be in math.h right alongside ''pi'' but it doesn''t
seem to be there, does it in fact exist? i did many searches online but it
is hard to search for the letter ''e'', even tried natural logs but came up
dry. Any help would be appreciated, thank you!

~Senturon

推荐答案




exp(1.0)

应该有效。它在< math.h>中。



exp(1.0)
should work. It''s in <math.h>.





事实上,C90

标准都不要求定义pi或e。始终定义的唯一宏math.h是HUGE_VAL。但是,

math.h确实提供了一些函数,你可以用它们在运行时获得这些

常量。


对于pi :acos(-1.0)

对于e:exp(1.0)


或者,如果您宁愿在编译时使用它们,只需坚持下去在自己

常数:


的#define PI(3.1415926535897932384626433832795028841971693994L)

的#define E(2.7182818284590452353602874713526624977572470937L)


-

Derrick Coetzee

我将此新闻组发布到公共领域。我不承担所有

明示或暗示保证并承担所有责任。我不是专业人士。



In fact neither definitions of pi nor e are required by the C90
standard. The only macro math.h always defines is HUGE_VAL. However,
math.h does supply some functions which you can use to obtain these
constants at runtime.

For pi: acos(-1.0)
For e: exp(1.0)

Alternatively, if you''d rather have them at compile-time, just stick the
constants in yourself:

#define PI (3.1415926535897932384626433832795028841971693994L )
#define E (2.7182818284590452353602874713526624977572470937L )

--
Derrick Coetzee
I grant this newsgroup posting into the public domain. I disclaim all
express or implied warranty and all liability. I am not a professional.





输入您的代码:


const double pi = 3.14159265358979324;

const double e = 2.71828182845904524;


你当然可以反常使用

#define PI(4 * atan(1) )



#define PI(6 * atan(1 / sqrt(3)))


以及

#define E(exp(1))



Put into your code:

const double pi=3.14159265358979324;
const double e= 2.71828182845904524;

you could, of course, perversely use
#define PI (4*atan(1))
or
#define PI (6*atan(1/sqrt(3)))

along with
#define E (exp(1))


这篇关于e的语法(自然日志)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-21 13:31