由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
EE版 - 请教使用C实现2^x的方法和代码(x为float)
相关主题
EDA职位 (转载)请教IBM ASSURA Floating gate check errors
Re: what's semiconductor packaging?在Fixed-Point的微处理器上编程,怎么实现floating point的加法乘法?
Re: 请教:How to generate Gaussian Noise in C?Re: 请搞光纤通信的看过来!!
Re: C#中,如何将字符串转化为double/float.Re: Call for help on Latex in Windows system
EE master出来只能做技术吗?JMOSCal -- a small tool for MOS calculations
请教一个dc dc 设计问题求助:spectre, wavescan, netlist, current measurement等
IBM_PDK->Check->Assura->Floating Gate另外一个cadence里的plot的问题
有谁用过Precision或者Synplify来综合FPGA的?问个从cadence export data的问题
相关话题的讨论汇总
话题: ln2话题: calculate话题: float话题: ln话题: precision
进入EE版参与讨论
1 (共1页)
r*********e
发帖数: 29495
1
多谢
c****e
发帖数: 7
2
Here is my answer to your question. It's NOT optimized for high precision,
but it shows the basic concept.
y=2^x -> lny=x*ln2 --> y=e^(x*ln2)
By using Taylor series expansion, e^x=sum(x^2/n!),n=0,1,2,3,...,
ln(1+x)=sum[(-1)^(n+1)*x^2/n!], -1 You need two steps to obtain 2^x:
1) calculate ln(1+1); Simply, you may just use ln2 as an input ln2=0.
69314718055994530941723212145818.
2) Calculate e^(x*ln2)
The c code was tested on DEV C++ 5.0. Please take care the precision you
need

【在 r*********e 的大作中提到】
: 多谢
r*****e
发帖数: 7853
3
take the bit from x

【在 r*********e 的大作中提到】
: 多谢
1 (共1页)
进入EE版参与讨论
相关主题
问个从cadence export data的问题EE master出来只能做技术吗?
Calculation of a micropower personal radio station请教一个dc dc 设计
how to calculate the amplification of OP07IBM_PDK->Check->Assura->Floating Gate
cadence中calculator plot一问有谁用过Precision或者Synplify来综合FPGA的?
EDA职位 (转载)请教IBM ASSURA Floating gate check errors
Re: what's semiconductor packaging?在Fixed-Point的微处理器上编程,怎么实现floating point的加法乘法?
Re: 请教:How to generate Gaussian Noise in C?Re: 请搞光纤通信的看过来!!
Re: C#中,如何将字符串转化为double/float.Re: Call for help on Latex in Windows system
相关话题的讨论汇总
话题: ln2话题: calculate话题: float话题: ln话题: precision