Results 1 to 2 of 2
I know this is weird to ask, but how do you set a variable as a decimal without using the keywords float/double?
I ask this because when I am compiling ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 06-20-2012 #1Just Joined!
- Join Date
- May 2012
- Posts
- 9
How to use a floating point by using Fixed Point Alogrithm?
I know this is weird to ask, but how do you set a variable as a decimal without using the keywords float/double?
I ask this because when I am compiling the Kernel I get an error when I use float/double in the tcp_vegas.c file.
In Linux Kernel you cannot use floating point numbers for some reason, but you can do it. I know what I said just bare with me lol. I know you could use these functions:
However I got these errors:Code:include<asm/i387.h> kernel_fpu_begin(); kernel_fpu_end();
So since I am getting these error and read some forums that I should avoid using kernel_fpu_begin(); and kernel_fpu_end();Code:ERROR: "__addsf3" [net/ipv4/tcp_vegas.ko] undefined ERROR: "__muldf3" [net/ipv4/tcp_vegas.ko] undefined ERROR: "__fixunsdfsi" [net/ipv4/tcp_vegas.ko] undefined ERROR: "__floatsidf" [net/ipv4/tcp_vegas.ko] undefined To see full details build your kernel with: 'make CONFIG_DEBUG_SECTION_MISMATCH=y'
My next idea would be making a Fixed Point function, but I don't have a really clear idea on how to create that function.
I understand thatis the equation I am aiming for, but how does help me use a floating number?Code:yi+1 = a.xi + b.yi
If you could give me links of examples c code of fixed point function or anything related to that would be great. Also your knowledge/explanation too.
Thanks
- 06-22-2012 #2Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 10,156
GCC currently has fixed point support built in, at least since about 2008 or 2009. Try a google search on the terms "gcc fixed point".
Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!


Reply With Quote
