Jump to content

Help File - Int()


Recommended Posts

Just wondering if the Help file shouldn't list Int() in with the Maths Functions rather than in with Variables and Conversions functions especially since Ceiling, Floor and Round are listed as Maths functions. I can understand why IsInt() is listed in with the Variables, just not sure about Int() which I would've considered a maths function.

Thoughts?

Link to comment
Share on other sites

Abs, Round, Floor and Ceiling all have to do with math. How is an absolute value not math related? You can't use it on any other types of variables...

Yes, that's my point. Int is exactly the same - you can't use it on any other types of variable other than numbers (well it can, but it just reports a zero value just as Abs, Round, Floor and Ceiling do).

My point is that Int is only useful when related to numbers, therefore, it follows that it belongs under mathematics, not variables. Other languages list INT as a mathematical function, why is AutoIt different? It doesn't make sense to me so I am trying to understand why it's been listed this way.

Link to comment
Share on other sites

In my opinion Int() is math-related because it truncates the decimal portion of a number. I see no harm in listing it under both categories but I wouldn't remove it from its current location.

Link to comment
Share on other sites

I should have pointed out that I realise INT can be used with strings, however, my understanding is that unless the string contains a number, INT will report a zero value as I would expect it to. In truth, I can see no reason to use INT on a variable unless you're after a mathematical outcome.

Link to comment
Share on other sites

I was about to note that Int can be used to limit precision of numbers to a certain decimal place, as that is what I have to do to get, in C++, a float to have precision at two decimal places. I just noticed the Round() though.

C++:

float roundFloat(float input)
{
   float output;
   output = (int) (input * 100);
   output = (float) output / 100;
   return output;
}

Note: That should work, but I did that in my head quickly, so check it against a compiler before using.

Writing AutoIt scripts since

_DateAdd("d", -2, _NowCalcDate())
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...