Search:

Type: Posts; User: flp1969

Page 1 of 20 1 2 3 4

Search: Search took 0.01 seconds.

  1. Thread: Win-bash use

    by flp1969
    Replies
    5
    Views
    355

    Another thing: This is not valid: $ x = 1 x:...

    Another thing: This is not valid:

    $ x = 1
    x: command not found

    Assignments must not have spaces:

    $ x=1
    $ echo $x
    1
  2. Replies
    11
    Views
    295

    Then it is a "practical" rounding, as in high...

    Then it is a "practical" rounding, as in high school?
    -0.001 is closer to 0.00 or -0.01?
  3. Replies
    11
    Views
    295

    You didn't read, did you? Floating point isn't...

    You didn't read, did you? Floating point isn't decimal!
  4. Replies
    11
    Views
    295

    You do realize floating point is not "decimal"...

    You do realize floating point is not "decimal" and not accurate enough to represent 0.001, don't you?

    Floating point is a fractional representation using 3 unsigned integer values: S, F and E,...
  5. Thread: DD to DMS

    by flp1969
    Replies
    5
    Views
    291

    float has 24 bits of precision, not 25... But you...

    float has 24 bits of precision, not 25... But you can use double (53 bits). In an Intel or ARM processor there's no difference in performance (only double has "double" the size, in comparison with...
  6. Ahhh... and this works very well: int...

    Ahhh... and this works very well:

    int lessThan( int a, int b )
    { return (a - b) >> ( sizeof(int) * CHAR_BIT - 1 ); }
    Right shift with signed integers are "dependent of implementation",...
  7. Well... no '

    Well... no '<' operator here (hehe)...

    // Intel/AMD:
    int lessThan(int a, int b)
    {
    int r = 0;

    __asm__ __volatile__ (
    "cmpl %2,%1\n\t"
    "sets %b0"
  8. Hummmm.... interesting. Thanks.

    Hummmm.... interesting. Thanks.
  9. Just a warning... When you do: line = NULL,...

    Just a warning... When you do:


    line = NULL, len = 0;
    while ( getline( &line, &len, fp ) != -1 )
    {
    ...
    }
    You are asking to getline allocate enough space to hold the first line, but if the...
  10. Replies
    16
    Views
    476

    There is a "portable" way. Using frexpf(): ...

    There is a "portable" way. Using frexpf():


    float m;
    int e;

    m = frexpf( value, &e );
    printf( "Value=%f -> m=%f, e=%d\n", value, m, e );
    frexpf() returns values between 0<=m<1, and e is the...
  11. Windows has CreateProcess() function on Win32 API.

    Windows has CreateProcess() function on Win32 API.
  12. Replies
    7
    Views
    385

    Share your code... I have no experience with...

    Share your code... I have no experience with PIC32, but already skim both datasheets. Glad to help if I can...
  13. Replies
    4
    Views
    721

    GLFW (https://www.glfw.org/)

    GLFW
  14. Replies
    7
    Views
    385

    Nope, it isn't unusual. And I don't see the...

    Nope, it isn't unusual. And I don't see the problem. The implementation is trivial:

    1- setup a 16 bit result to 0;
    2- Set SDI to 1 and pulse the CNV signal (0 to 1 and back to 0, Tcnv ns [1->0...
  15. Replies
    7
    Views
    385

    Without the actual interface between PIC and AD...

    Without the actual interface between PIC and AD isn't possible to tell you anywhing. Show the circuit and your attempt with code...

    Did you tried the CS-Mode?

    16335
  16. A small program to test this: #include...

    A small program to test this:

    #include <stdio.h>
    #include <math.h>

    float fact ( unsigned int x )
    {
    float n = 1.0;

    while ( x > 1 )
  17. Replies
    5
    Views
    455

    Or, using the wrapper functions and worrying...

    Or, using the wrapper functions and worrying about endianess:


    #include <unistd.h>
    #include <arpa/inet.h>

    int n = 1;

    // Write all bytes of n in BIG ENDIAN format.
    n = htonl( n );
  18. Replies
    15
    Views
    699

    Using RDRAND: // test.c - code for x86-64...

    Using RDRAND:

    // test.c - code for x86-64 (gcc).
    #include <stdio.h>
    #include <stdlib.h>
    #include <x86intrin.h>

    static int check_rdrand ( void );
    static double rand_ ( double, double );
  19. Replies
    15
    Views
    699

    You asked for a "platform neutral" method......

    You asked for a "platform neutral" method... rand() returns an uniform distributed random number in the range 0..RAND_MAX, usually through a LCG algorithm. In a 32 bit processor this is, again,...
  20. Replies
    15
    Views
    699

    #define swapd(a,b) ( double t_; t_ = (a); (a) =...

    #define swapd(a,b) ( double t_; t_ = (a); (a) = (b); (b) = t_; }

    double rand_range( double min, double max )
    {
    double r;

    if ( min > max )
    swapd( min, max );

    r = rand() /...
  21. Replies
    7
    Views
    334

    Ok. At this magnitude a long double has 1 ULP =...

    Ok. At this magnitude a long double has 1 ULP = 0.5. It means the imprecision is +/- 0.25. As for a double, 1 ULP = 1024 giving an imprecision of +/- 512. To illustrate, 5579207423999930400.0 cannot...
  22. Replies
    7
    Views
    334

    What do you mean "large values"? double supports...

    What do you mean "large values"? double supports values between +/-1.78769*10⁰⁸ (large enough for me).
    Using long double is always a overkill (large object representation in memory and no support...
  23. Replies
    4
    Views
    530

    And: 1- gethostbyname() is an old and obsolete...

    And:

    1- gethostbyname() is an old and obsolete function. Use getaddrinfo();
    2- sockaddr_in.sin_addr.s_addr is a simple 'unsigned int'. Don't need 'memcpy()' to write on it;
    3- Don't use...
  24. author='Your name here' for file in *.c; do ...

    author='Your name here'
    for file in *.c; do
    sed -i "s/<File Name>/$file/;s/<Author>/$author/;s/<Date>/$(date)/" $file
    done
  25. Replies
    7
    Views
    741

    ridderunnersjw, think of pointers as types that...

    ridderunnersjw, think of pointers as types that hold an address and addresses are unsigned integers (linke indices of an array). In C there are a difference in declaring an object and using it. If...
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4