Search:

Type: Posts; User: flp1969

Page 1 of 20 1 2 3 4

Search: Search took 0.01 seconds.

  1. And, in other architetures besides Intel (like...

    And, in other architetures besides Intel (like ARM) these functions are different. Here the 3 isCrossing() in ARM Cortex-A53 using vfp3-d16:


    isCrossing:
    ldm r0, {r0, r3}
    lsr r3, r3, #31
    ...
  2. The second tip is ok (droping a !), but the third...

    The second tip is ok (droping a !), but the third is a little bit different, since uses two floating point comparisons.
    Notice signbit simply isolates the sign bit without any comparison... The...
  3. NOT a correction, just a little bit of...

    NOT a correction, just a little bit of improvement. Instead of:


    bool isCrossing(float *pair) {

    return pair[0] < 0 && pair[1] >= 0 ||
    pair[0] > 0 && pair[1] <= 0;
    }

    Well......
  4. Replies
    10
    Views
    488

    leopoldo100, when you say "very simple" it means...

    leopoldo100, when you say "very simple" it means from a user point of view. Video players aren't "simple", even when using some library (like ffmpeg's libav*).
  5. Yep... Try to compile the same code for i386 (or...

    Yep... Try to compile the same code for i386 (or x86, as you called) and you'll get:

    section .text

    _multiplyByTwo:
    fld QWORD [esp+4]
    fadd st, st(0)
    ret

    section .rdata
  6. Unless you are compiling your code without any...

    Unless you are compiling your code without any optimizations enabled, the compiler will use the stack to store local variables only if needed. In general, for optimized code, the compiler uses...
  7. Replies
    6
    Views
    390

    Notice you can use getline() [POSIX] to get a...

    Notice you can use getline() [POSIX] to get a line of any size (dynamically allocated), strtok() to isolate "pieces" of the line and strtoul() to try to convert strings from octal to unsigned long...
  8. Replies
    6
    Views
    390

    Another small thing... In the comments you said:...

    Another small thing... In the comments you said:

    "Write a function that reads data from standard input until EOF is found and returns the sum of the base-8 numbers found into the input."

    So,...
  9. XOR has 3 basic uses: To invert bits based in a...

    XOR has 3 basic uses: To invert bits based in a mask; To get the result of different bits in both operands or as a caryless add.
    This kind of code is a trick to swap values without using a temporary...
  10. Replies
    9
    Views
    709

    UNICODE encoding is a 31 bits value corresponding...

    UNICODE encoding is a 31 bits value corresponding to a single character. The trailing 16 bits correspond to a character in a "plane" the upper 16 bits. Actually planes 0, 1, 2, 3, 14, 15 and 16 are...
  11. Replies
    17
    Views
    779

    Easier if you check only if the next value is...

    Easier if you check only if the next value is greater than the previous (or vice-versa).
  12. Replies
    7
    Views
    419

    Didn't you mean how to get the PID of the process...

    Didn't you mean how to get the PID of the process dispatching the signal? Because the PID of the process "calling" the handler will be the same as the process which the handler was registered by...
  13. Replies
    7
    Views
    419

    Didn't you mean how to get the PID of the process...

    Didn't you mean how to get the PID of the process dispatching the signal? Because the PID of the process "calling" the handler will be the same as the process which the handler was registered by...
  14. As Salem said... break your code in small...

    As Salem said... break your code in small portions. Here's my implementation with comments for your study:

    // cobalt.c
    //
    // Compile and link:
    //
    // $ gcc -O2 -o cobalt cobalt.c # add -lm if...
  15. Here's a brief explanation about 'floating point'...

    Here's a brief explanation about 'floating point' based on Salem's correct comments on the subject above.

    "Precision" is the number of significative digits (in this case, BITS) of a...
  16. Replies
    1
    Views
    224

    %[^...] means the same as %s but excludes those...

    %[^...] means the same as %s but excludes those characters (in your case from '0' to '9' and '-').

    Another thing: scanf() returns EOF only if any of the conversions can't be done and if you reach...
  17. Replies
    3
    Views
    320

    Since + has higher precedence than

    Since + has higher precedence than <<, (1U << i + 1) is correct, no parentesis needed.

    I could agree that writing (1U << (i + 1)) makes the expression clearer, but the previous isn't wrong.
  18. Replies
    10
    Views
    484

    In my example code here's some ways to avoid...

    In my example code here's some ways to avoid using goto in this fragment:


    if ( scanf ( "%lf%c + %lf = %lf", &a, &y, &b, &c ) != 4 )
    {
    invalid_input:
    puts ( "Invalid input!" );
    ...
  19. Replies
    10
    Views
    484

    As John says, for beginners, yes... goto should...

    As John says, for beginners, yes... goto should be avoided, even for experienced programmers, but it isn't always 'bad'.

    And. yes... I do know what I am talking about.
  20. Replies
    10
    Views
    484

    Why not? Just because Dijkstra told you so? ...

    Why not? Just because Dijkstra told you so?

    And fflush(stdout) is there not because scanf(), but because stdout is line buffered. Not all c libraries garantees the flushing of the buffer just...
  21. Replies
    10
    Views
    484

    scanf() returns the number of convertions made. ...

    scanf() returns the number of convertions made.

    You should test if a is zero before trying to use it as a divisor.

    %lf in printf() has a different meaning than on scanf().

    You don't need...
  22. Thread: fgets and size

    by flp1969
    Replies
    4
    Views
    386

    If your compiler/c standard library is POSIX:2008...

    If your compiler/c standard library is POSIX:2008 compliant you can use getline() function, which will allocate the buffer for the line for you:


    char *line;
    size_t size;

    // Need this for...
  23. Replies
    4
    Views
    1,234

    Start? Where is YOUR code?

    Start? Where is YOUR code?
  24. Replies
    8
    Views
    432

    Avoid using system(). Since you are using...

    Avoid using system(). Since you are using Windows, use the Console API do clear the screen:

    #include <windows.h>
    ...
    void clearscreen(void)
    {
    HANDLE hConsole;
    COORD coord = {0, 0};
    ...
  25. Thread: Math help?

    by flp1969
    Replies
    2
    Views
    334

    Are you sure? The final value must be...

    Are you sure? The final value must be 8.6805553436279296875 in single precision (8.68055555556 cannot be represented in any floating point precision).
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4