English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I'm developing code for an embedded controller. I need to calculate the value of 10^x where x is a floating point number between -4 and 0.

I've tried using the built in C functions but they take too long.

I'm aware of a trick for whole values of x where you perform one calculation if x is odd and a different one if x is even. Afterward, you divide the binary value of x by 2 (shift x to the right one position) and repeat until x is 0.

Are there other tricks to calculate this value?

2007-08-16 08:13:25 · 6 answers · asked by Anonymous in Science & Mathematics Mathematics

6 answers

I'm not a programmer, but mathematically,

y=10^x

log(y)=x[log(10)]

log(y)=x

2007-08-16 08:21:24 · answer #1 · answered by de4th 4 · 0 1

y=10^x ====> D=-4 < x < 0
min= x= -4 ====> y=10^-4 = 0.0001
max=x= 0 ====> y=10^0 = 1

===> R= 0.0001 < y < 1

2007-08-24 04:39:28 · answer #2 · answered by mahyar h 2 · 0 0

a million) 2(x-6) = 9x+2 2x-12 = 9x+2 -14 = 7x x = -14/7 x = -2 --- Ans. 2) 4(2-x) = -2(x+5) 8 - 4x = -2x - 10 8 + 10 = -2x + 4x 18 = 2x x = 18/2 x = 9 --- Ans 3) 13 = 31+2(5x-2) 13 = 31 + 10x - 4 13 - 27 = 10x -14 = 10x x = -a million.4 ---Ans 4) 4(2x-6)-9x = sixteen 8x - 24 - 9x = sixteen - x = sixteen + 24 x = - 40 ---Ans you need to prepare those on your own nevertheless.they seem humorous, yet they're relatively relatively undemanding. purely try next time, eh?

2016-12-12 04:00:14 · answer #3 · answered by Anonymous · 0 0

Assuming you work with a granularity of 0.01
to go from -4.00 to 0.00 you have 401 steps

if you have enough memory you could simply store the 401
values in a table in the program and extract the right value.

It is certainly the fastest possible method

2007-08-16 12:12:56 · answer #4 · answered by cd4017 4 · 1 0

Probably lookup tables are your best bet.
Use a simple interpolation to give values between the points in the lookup table.

2007-08-16 08:22:35 · answer #5 · answered by dogsafire 7 · 0 0

10^x were x floatates between -4 & 0
10^-4 uo to 10^0
1/10^4 up to 0
1/10,000 up to
From 0.0001 up to 0

2007-08-16 08:24:50 · answer #6 · answered by robertonereo 4 · 0 0

fedest.com, questions and answers