Search:

Type: Posts; User: flp1969

Page 1 of 20 1 2 3 4

Search: Search took 0.01 seconds.

  1. Replies
    2
    Views
    145

    Depends on the compiler optimization. Could be on...

    Depends on the compiler optimization. Could be on registers.
  2. Replies
    14
    Views
    230

    If you want to initialize a bunch of elements of...

    If you want to initialize a bunch of elements of dynamically allocated array you can do as @Zeus_ told you:

    p[0] = 5;
    p[1] = 15;
    p[2] = 5;
    p[3] = 53;
    p[4] = 101;
    Or, in C (not C++), with a...
  3. Replies
    14
    Views
    230

    Use the operador [] or the operator *: int...

    Use the operador [] or the operator *:


    int *p;

    p = malloc( size * sizeof( int ) );
    for ( i = 0; i < size; i++ )
    p[i] = K; // OR *(p + i) = k;
  4. Replies
    14
    Views
    230

    See? Very easy to spot, isn't it? Now some...

    See? Very easy to spot, isn't it?
    Now some considerations:

    #include <stdio.h>
    #include <stdlib.h>

    int main( void )
    {
    // You don't need to use type casting here, malloc() will return a...
  5. Replies
    14
    Views
    230

    Well, yeah, but there is a another error... look...

    Well, yeah, but there is a another error... look closer... a little longer...
  6. Replies
    14
    Views
    230

    Take a good look at your printf() calls...

    Take a good look at your printf() calls...
  7. Replies
    14
    Views
    230

    1st- You are not allocating "one" integer, but 5...

    1st- You are not allocating "one" integer, but 5
    2nd- You are printf the same variable (i)
    3rd- You are getting warnings from your compiler and not paying attention to them.
  8. Thread: bigint modpow

    by flp1969
    Replies
    3
    Views
    131

    By "bigint" you mean multiple precision...

    By "bigint" you mean multiple precision arithmetic integer types?
    Try libgmp.
  9. Thread: FPN math

    by flp1969
    Replies
    50
    Views
    721

    Are you refering to post #18? It so: "Handbook of...

    Are you refering to post #18? It so: "Handbook of Floating-Point Arithmetic" (Jean-Michael Muller, Nicolas Brisebarre, Florent De Dinechin, Claude-Pierre Jeannerod, Vincent Lefèvre, Guillaume...
  10. Replies
    2
    Views
    120

    Take a look at this...

    Take a look at this thread.
  11. Thread: FPN math

    by flp1969
    Replies
    50
    Views
    721

    PS: Maybe you can get everything you need from...

    PS: Maybe you can get everything you need from here. This is one of the best books I've seen on floating point...
  12. Thread: FPN math

    by flp1969
    Replies
    50
    Views
    721

    Take a look at strtod() implementation from...

    Take a look at strtod() implementation from glibc... it uses multiple precision (MP) arithmetic. So you need integers with precision greater than the targeted floating point type. You only need...
  13. Replies
    1
    Views
    102

    Because DBL_MIN isn't the smallest value possible...

    Because DBL_MIN isn't the smallest value possible for double. DBL_MIN is the smallest normalized value.

    2.225074e-309 is, indeed an underflow (what IEEE call it a "gracious underflow") because it...
  14. Thread: FPN math

    by flp1969
    Replies
    50
    Views
    721

    Well... here it worked well (there is a problem...

    Well... here it worked well (there is a problem thou):

    #include <assert.h>
    #include <stdio.h>
    #include <stdint.h>

    union fp_u {
    float f;
    struct {
    unsigned int m:23;
  15. What are the FoV appertures you are using? Wider...

    What are the FoV appertures you are using?
    Wider FoV, more distorted you'll get. Games usually uses 90° horiz and 60° vertical to mimic "human eye".
  16. I see... but nobody, until now, proved if this is...

    I see... but nobody, until now, proved if this is correct... I have my doubts...
  17. This is essentially the same routine I posted...

    This is essentially the same routine I posted before, except you check for divisors by 3 in the beginning (starting the checks in the loop, for divisors by 5)... A better way, which can consume a lot...
  18. Thread: FPN math

    by flp1969
    Replies
    50
    Views
    721

    Fixed point to floating point then? If you...

    Fixed point to floating point then? If you already have the bits isn't its just a matter of shifting then to the correct position?

    Of course, you have to recalculate the fractional part... if you...
  19. Hummmm.... interesting approach!! I have to study...

    Hummmm.... interesting approach!! I have to study a little bit more to try to catch any flaws... awesome!
    For now I can only see three potential problems... doing 'f*f' can result in an overflow if...
  20. Thread: FPN math

    by flp1969
    Replies
    50
    Views
    721

    What do you want to do? Convert an unsigned int...

    What do you want to do? Convert an unsigned int to float?
    If this is the case I suggest calculating the expoent first:

    e=log2(N);

    You can get an reliable log2() integer function from Bit...
  21. And, correct me if I'm wrong... testing n,...

    And, correct me if I'm wrong... testing n, getting the remainder of the division by 6 (if it is 1 or 5) only checks if n isn't divisible by 3 (since my routine already ruled out even numbers, except...
  22. MIP Maps and Antialiasing filters didn't work?

    MIP Maps and Antialiasing filters didn't work?
  23. Neither I said that... All I'm saying is there...

    Neither I said that... All I'm saying is there are a lot of x values, using this criteria, where they are NOT primes... It is not a reliable criteria because of this first reason and because you will...
  24. Good point... 1 isn't prime as well... :) How to...

    Good point... 1 isn't prime as well... :)
    How to use multiplication instead of square root?
    I didn't get it the '6x ± 1' tip. If this is true, than criptographic algorithms like RSA would be very...
  25. Not only you can boost the performance of...

    Not only you can boost the performance of primalty test using the square root criteria, but you can boost the GCD algorithm as well using binary tricks.
    Here's a GCC implementation.


    #include...
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4