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 #1
- Join Date
- May 2012
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:
include<asm/i387.h> kernel_fpu_begin(); kernel_fpu_end();
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 thatCode:
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.
- 06-22-2012 #2
- Join Date
- Apr 2009
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
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!