Search:

Type: Posts; User: hamster_nz

Page 1 of 18 1 2 3 4

Search: Search took 0.02 seconds.

  1. Replies
    2
    Views
    884

    Assuming you want to know the truth, and not just...

    Assuming you want to know the truth, and not just the first-level approximation...

    On Linux you can use the 'objdump' command to see what the C compiler has generated - what goes where in memory. ...
  2. For query 3, different CPUs handle it...

    For query 3, different CPUs handle it differently.

    Intel x86 CPUs manage the call stack for you, so have a "Stack Pointer" register, and a "Base Pointer" register. When you call a subroutine the...
  3. Replies
    4
    Views
    1,789

    If you don't want to calculate the RMS of all...

    If you don't want to calculate the RMS of all values ever seen (e.g. only the last 10 samples), and you want to do it efficently, then this is how I would do it:



    #include <stdio.h>
    #include...
  4. Replies
    3
    Views
    2,246

    Have you compiled with warnings turned on? I...

    Have you compiled with warnings turned on?

    I guess not, because appenededline[0] is a character, not an array you can snprintf() into safely.
  5. "Project Euler problems are not so much...

    "Project Euler problems are not so much programming problems as math problems"

    In that spirit, out-sourcing the heavy lifting to an external arbitrary precision libraries defeats most of the...
  6. Replies
    3
    Views
    1,314

    Seg faults sre usually generated by the OS. On...

    Seg faults sre usually generated by the OS.

    On most hardware the segfault occurs when you try to access a virtual memory address where the OS doesn't know how to map it to a physical address.
    ...
  7. Replies
    11
    Views
    1,956

    2^1000 will be about a 300 digit number, and is...

    2^1000 will be about a 300 digit number, and is far more than any standard data type can hold.

    You should investigate using the "double dabble" algorithm.

    Double dabble - Wikipedia
  8. Replies
    11
    Views
    1,956

    The first google hit I got was: gcc - C-Prog...

    The first google hit I got was:

    gcc - C-Prog Code::Blocks -- math.h library not linking within IDE ... works fine in command line. Where is the file/folder to link in IDE? - Stack Overflow
  9. Replies
    11
    Views
    1,956

    You most probably need to link against the math...

    You most probably need to link against the math library - libm.

    For GCC you need the '-lm' compile option.

    The GCC compiler will optimize / inline some simple functions to improve performance...
  10. Replies
    16
    Views
    3,643

    Still brute force, and the code isn't secret,...

    Still brute force, and the code isn't secret, just not that well written or interesting. Here's the most interesting bit:



    struct Factor {
    uint64_t factor;
    uint64_t power;
    };
  11. Replies
    16
    Views
    3,643

    Had another hack at it... $ time ./a The...

    Had another hack at it...



    $ time ./a
    The 560th triangular number 157080 has 128 factors
    The 2079th triangular number 2162160 has 320 factors
    The 12375th triangular number 76576500 has 576...
  12. Replies
    16
    Views
    3,643

    Actually I'm overthinking it... #include...

    Actually I'm overthinking it...



    #include <stdio.h>


    int main(int argc, char *argv[])
    {
    int j = 1;
  13. Replies
    16
    Views
    3,643

    The 'x'th triangular numbers have the formula...

    The 'x'th triangular numbers have the formula (x)(x+1)/2. You want both (x+1) and x to have lots of unique prime factors as this will give x(x+1)/2 to have lots of factors.

    Using this knowledge...
  14. Replies
    16
    Views
    3,643

    Calc right hand side, (y+1) then multiply the...

    Calc right hand side, (y+1) then multiply the left hand side by that value.

    I am going to give that puzzle a try... long time sicne I did any project Euler.
  15. Can't tease out single bits with the data you...

    Can't tease out single bits with the data you supplied, but can get a few pairs out:





    0100100A00000000002040000000FFFFFFFFFF9894
    0100100A00000000002020000000FFFFFFFFFF6512...
  16. XORing those strings together, I'm not so sure...

    XORing those strings together, I'm not so sure it's a CRC.

    There is minimal chance that a 16-bit CRC would generate the same checksum for different bit patterns that are ~16 bits long.

    [/code]...
  17. All the 'local' variables live on the 'stack'....

    All the 'local' variables live on the 'stack'. The uninitialized variables in your main() function are reusing areas of the stack that have been previously used as the C runtime sets up the...
  18. Google (and now ChatGPT) will usually give you...

    Google (and now ChatGPT) will usually give you what you would *assume* the answer would be, given a shallow understanding of the topic. Basically it will be bias confirmation - if you ask a naïve...
  19. What does it do with denormalized numbers? Does...

    What does it do with denormalized numbers? Does it handles non-numbers like infinity?
  20. I've reformatted that code a bit, and it's...

    I've reformatted that code a bit, and it's incomplete, making it hard to reason about:



    node * ekleSirali(node * r, int x) {
    if(r==NULL)
    {
    //linklist
    bossa ...
  21. I guess you haven't seen the stupid regular...

    I guess you haven't seen the stupid regular expression-like format strings that some people come up with?

    Just the first example I found on Stack Overflow:


    scanf("%4[^,],%4[^,],%79[^,],%d",...
  22. printf() and scanf() are what they are... a...

    printf() and scanf() are what they are... a relatively flexible way to formatted output to or from a FILE *.

    IMO they really are Swiss Army Knife functions, and where they don't naturally fit...
  23. Oh, a rookie mistake is forking with data file...

    Oh, a rookie mistake is forking with data file handles open.... when you move the file pointer in one one process it will move the file pointer in all processes that are using the same file handle.
  24. You also need to be careful how you coordinate...

    You also need to be careful how you coordinate multiple process accessing the shared memory, and in same cases caches between processes.

    If you only add entries into the structures you can...
  25. Replies
    6
    Views
    2,341

    This site might help: Online CRC-8 CRC-16...

    This site might help:

    Online CRC-8 CRC-16 CRC-32 Calculator

    Also, this code might help playing around with different parameters:



    #include <stdio.h>
Results 1 to 25 of 444
Page 1 of 18 1 2 3 4