Search:

Type: Posts; User: flp1969

Page 1 of 20 1 2 3 4

Search: Search took 0.02 seconds.

  1. Replies
    5
    Views
    161

    I can

    I can
  2. Replies
    6
    Views
    156

    Shoudn't be %f instead of %d?

    Shoudn't be %f instead of %d?
  3. Replies
    5
    Views
    240

    Selection sort... walk through the first element...

    Selection sort... walk through the first element to the last but one (i). Inside that loop, walk to the second element to the last (j). Compare element at position i to the element at position j. If...
  4. Replies
    15
    Views
    535

    /proc/mounts or /proc/self/mounts

    /proc/mounts or /proc/self/mounts
  5. Thread: Win-bash use

    by flp1969
    Replies
    5
    Views
    657

    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
  6. Replies
    11
    Views
    491

    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?
  7. Replies
    11
    Views
    491

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

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

    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,...
  9. Thread: DD to DMS

    by flp1969
    Replies
    5
    Views
    477

    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...
  10. 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",...
  11. 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"
  12. Hummmm.... interesting. Thanks.

    Hummmm.... interesting. Thanks.
  13. 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...
  14. Replies
    16
    Views
    802

    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...
  15. Windows has CreateProcess() function on Win32 API.

    Windows has CreateProcess() function on Win32 API.
  16. Replies
    7
    Views
    517

    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...
  17. Replies
    4
    Views
    894

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

    GLFW
  18. Replies
    7
    Views
    517

    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...
  19. Replies
    7
    Views
    517

    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
  20. 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 )
  21. Replies
    5
    Views
    674

    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 );
  22. Replies
    15
    Views
    1,053

    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 );
  23. Replies
    15
    Views
    1,053

    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,...
  24. Replies
    15
    Views
    1,053

    #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() /...
  25. Replies
    7
    Views
    511

    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...
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4