Search:

Type: Posts; User: then

Search: Search took 0.01 seconds.

  1. Replies
    24
    Views
    7,126

    I don't understand. I know Soma said that too,...

    I don't understand. I know Soma said that too, but I didn't have to provide arguments of the same type when ftype was defined as float, since I provided it with a float and an int and it worked....
  2. Replies
    24
    Views
    7,126

    I tried your class, iMalc, and everything seems...

    I tried your class, iMalc, and everything seems to work like it does for floats or doubles, except from the ?: operator, just like for the class I defined.

    Also, I had to change the return value...
  3. Replies
    24
    Views
    7,126

    phantomotap, I appreciate your support and you...

    phantomotap, I appreciate your support and you might be right about what you say, but if you want to help people you can't start by offending them.



    Thanks, it looks great. I haven't got time...
  4. Replies
    24
    Views
    7,126

    So you should have an opinion that is relevant...

    So you should have an opinion that is relevant but not me? And I don't know what it was I wrote that you think is wrong. It is easy to just ignore the rest of what you are writing when you start your...
  5. Replies
    24
    Views
    7,126

    It would be interesting to see your...

    It would be interesting to see your implementation and if it differs something from my class (except from that my isn't finished yet).
  6. Replies
    24
    Views
    7,126

    I don't get this error when f just is a normal...

    I don't get this error when f just is a normal float, that is why a base_safe_float<float> shouldn't generate any error here either.



    Okay. I have already started to write the other operators...
  7. Replies
    24
    Views
    7,126

    Doesn't the compiler realize that it can just use...

    Doesn't the compiler realize that it can just use the conversion operator and then compare a float against whatever it is I want to compare it against?
  8. Replies
    24
    Views
    7,126

    I'm trying. So far I the class declaration looks...

    I'm trying. So far I the class declaration looks like this:



    template<typename T>
    class base_safe_float
    {
    public:
    /* Constructors */
    base_safe_float(); // Default constructor
  9. Replies
    24
    Views
    7,126

    Thank you, that is one way to generate a NaN,...

    Thank you, that is one way to generate a NaN, yes. But the question was how to make the kind of class I described above.
  10. Replies
    24
    Views
    7,126

    Float that initializes to NaN

    Hi! I want to make a class that works exactly like a float, only that it is initialized to NaN when the default constructor is called and if DEBUG is defined so that I can easily detect when I have...
  11. Replies
    5
    Views
    1,169

    Ah, okay, that makes sense. Well, thanks for the...

    Ah, okay, that makes sense. Well, thanks for the answers.
  12. Replies
    5
    Views
    1,169

    > "The expression that controls conditional...

    > "The expression that controls conditional inclusion"

    I don't want to conditionally include a file, I just want to select between two snippets of code. But I take it all preprocessor conditions...
  13. Replies
    5
    Views
    1,169

    Precompiler problem

    Hi, if define A as



    #define A 100


    and write
  14. Replies
    8
    Views
    1,760

    Okay, thanks for the answer. I think I will just...

    Okay, thanks for the answer. I think I will just define the function explicitly for all types I am going to use it for, since it rather small, and skip the template.
  15. Replies
    8
    Views
    1,760

    Simply because it's simpler to write foo(0, 0.5)...

    Simply because it's simpler to write foo(0, 0.5) :P If I define foo as


    double foo(double a, double b)
    {
    return a + b;
    }

    then foo(0, 0.5) compiles, so I want it to compile even for my...
  16. Replies
    8
    Views
    1,760

    Help with template class

    I wonder how to solve a problem that I have with a template function. The function definition looks like


    template<typename T>
    T foo(T a, T b)
    {
    return a + b;
    }

    but this produces an...
  17. Replies
    6
    Views
    3,024

    Agreed. You might be especially right with the...

    Agreed. You might be especially right with the last part because our program doesn't even work yet! Thanks for getting me on the right track.
  18. Replies
    6
    Views
    3,024

    It was just a very simple example. In my case the...

    It was just a very simple example. In my case the variable is of course not called ONE, but is a parameter used in a simulation program. If SI units are used, this parameter will not be one and it...
  19. Replies
    9
    Views
    2,163

    Okay, thanks for being more clear. This other...

    Okay, thanks for being more clear. This other guy, has he successfully made it in this way? If not, this method seems highly unlikely to succeed if it's not known to work for this game. You seem to...
  20. Replies
    9
    Views
    2,163

    Ehm, yeah it's out of our fields right, that's...

    Ehm, yeah it's out of our fields right, that's why we can't help you. Have you considered that the reason we can't help you is because you have only been speaking gibberish? It should be pretty clear...
  21. Replies
    9
    Views
    2,163

    rand() % 100 will give you a number between 0 and...

    rand() % 100 will give you a number between 0 and 99. To do something with num_percent percent chance, use the following:



    if (rand() % 100 < num_percent) {
    // Do something
    }
    else {
    ...
  22. Replies
    9
    Views
    2,163

    What are you talking about?? To begin with; what...

    What are you talking about?? To begin with; what is your question? I did not see any question in your post. You are playing a game, okay, but – upgrading your gear; what gear? Linking items in it;...
  23. Replies
    3
    Views
    2,163

    Learn C++ and it should be a simple matter. I...

    Learn C++ and it should be a simple matter. I don't think there exists any tool that converts MatLab code to C++, partly because it would depend much on the way the code is supposed to be...
  24. Replies
    6
    Views
    3,024

    mingw optimization question

    Does mingw optimize multiplication/division by one? That is, if I write


    ONE * a
    or


    a * ONE
    or
Results 1 to 24 of 25