Search:

Type: Posts; User: hamster_nz

Page 1 of 9 1 2 3 4

Search: Search took 0.01 seconds.

  1. Thread: DD to DMS

    by hamster_nz
    Replies
    5
    Views
    216

    I've finally got to the point where I no longer...

    I've finally got to the point where I no longer trust floating point - because some things are a little unpredictable, and "float" is only accurate to 25 bits, and just degrees, minutes and seconds...
  2. Thread: DD to DMS

    by hamster_nz
    Replies
    5
    Views
    216

    Do you have some test data and results you can...

    Do you have some test data and results you can share?
  3. Replies
    4
    Views
    145

    It's way easier than that. For 16-bit signed...

    It's way easier than that. For 16-bit signed numbers the most significant bit has a 'place value' of -32768, rather than the 32768 it would have in an unsigned (or longer) value.

    So 0x8011 as a...
  4. Replies
    4
    Views
    145

    Lots of things going on here, but in summary, if...

    Lots of things going on here, but in summary, if 'int' is 16 bits, and you have a overflow the answer will be wrong by 2^16, or 65536.

    So what is 32785-65536? −32,751
  5. Replies
    5
    Views
    193

    It is quite likely that you will still have the...

    It is quite likely that you will still have the same problem. You don't want to speed up the comparison, but reduce the number of comparisons.

    What is the bigger problem you are trying to solve?
  6. It is common to have two-stage locknig... Idle...

    It is common to have two-stage locknig...

    Idle - nobody is accessing the data.

    Shared - everybody cn access, but nobody can change.

    Exclusive - only one thread can access the structure.
    ...
  7. Replies
    16
    Views
    424

    Or just use addition... #include ...

    Or just use addition...



    #include <stdio.h>
    int main(int argc, char *argv[]) {
    float f;
    int x;
    int e = 0;
  8. Replies
    16
    Views
    424

    But.... Why? I mean, it is possible, and I can...

    But.... Why?

    I mean, it is possible, and I can do it, but why do you want to?

    And why the restriction on what elementary operators you can use?
  9. Replies
    5
    Views
    418

    Here is using the "read" and "write" system calls...

    Here is using the "read" and "write" system calls directly.

    Note that this program needs no header files, as it is accessing the Linux system calls directly rather than using any library functions...
  10. Replies
    5
    Views
    418

    To write an integer to a file int i; ...

    To write an integer to a file



    int i;
    fwrite(&i,sizeof(i),1,f);


    To read an integer from a file
  11. Replies
    4
    Views
    341

    Here's a state machine for traffic lights. It...

    Here's a state machine for traffic lights. It might give you ideas:



    #include <stdio.h>
    #include <unistd.h>


    enum State { state_all_stop, state_NS_go, state_NS_stopping, state_WE_go,...
  12. Replies
    4
    Views
    341

    I don't usually support gambling, but in this...

    I don't usually support gambling, but in this case I bet you are asking us to do your homework for you.
  13. Replies
    15
    Views
    664

    Which header file is DBL_MANT_DIG defined in? ...

    Which header file is DBL_MANT_DIG defined in?

    Ah, found it - float.h

    That is a pretty good solution.
  14. Replies
    15
    Views
    664

    This isn't perfect and isn't portable, but how I...

    This isn't perfect and isn't portable, but how I would think about it.

    Note I haven't tested it on multiple platforms



    #include <stdio.h>
    #include <stdlib.h>
    #include <stdint.h>
    #include...
  15. Replies
    15
    Views
    664

    It's pretty inefficient, and I'm not so sure that...

    It's pretty inefficient, and I'm not so sure that "range == 0" is a good idea.

    If doing this, I would generate random bits for the memory holding the double, then explicitly mask and set the sign...
  16. Replies
    4
    Views
    497

    It looks like you are not checking that you are...

    It looks like you are not checking that you are correctly opening the output file



    dst = fopen(obuf, "w+");


    You should check to see if dst is not NULL.
  17. Replies
    4
    Views
    497

    Even just enabling warnings on your compiler will...

    Even just enabling warnings on your compiler will help...



    gcc -o main main.c -Wall -pedantic -O4
    main.c: In function ‘main’:
    main.c:24:18: warning: implicit declaration of function ‘fatal’...
  18. Replies
    8
    Views
    562

    ... just to be sure...

    ... just to be sure...
  19. Can you show where you open the file to read it?

    Can you show where you open the file to read it?
  20. There is one more number between 1.0-DBL_EPSILON...

    There is one more number between 1.0-DBL_EPSILON and 1.0:



    #include <float.h>
    #include <stdio.h>


    void printhex(void *x, size_t s) {
    for(size_t i = 0; i < s; i++)
  21. Me? I would most likely do what I did when I...

    Me? I would most likely do what I did when I needed random numbers that were inside a sphere. Generate random numbers between -1 and 1 (inclusive), and if it s >= 1.0 or <= -1.0 then just loop and...
  22. So I've got this 10GB file of 'baseband' data....

    So I've got this 10GB file of 'baseband' data. It's a 2-channel WAV file, but rather than left and right stereo it's what is called I+Q. It's called baseband because rather than a radio signal at...
  23. If it is an integer -1 < x < 1 then it doesn't...

    If it is an integer -1 < x < 1 then it doesn't leave many options....
  24. Replies
    1
    Views
    436

    The first thing I see is that >= 0should just be...

    The first thing I see is that >= 0should just be > 0.
  25. Currently I am working on decoding the telemetry...

    Currently I am working on decoding the telemetry of the Falcon 9 second stage.

    I've got a raw 10GB data file of the baseband signal, so am building on my DSP skills to convert it into the binary...
Results 1 to 25 of 220
Page 1 of 9 1 2 3 4