Find the answer to your Linux question:
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.
  1. #1
    Just 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:


    Code:
    include<asm/i387.h>
    kernel_fpu_begin();
    kernel_fpu_end();
    However I got these errors:

    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'
    So since I am getting these error and read some forums that I should avoid using kernel_fpu_begin(); and kernel_fpu_end();

    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 that
    Code:
    yi+1 = a.xi + b.yi
    is the equation I am aiming for, but how does help me use a floating number?

    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

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,755
    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!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •