|
Joined: Sep 2003
Posts: 4,230
Hoopy frood
|
OP
Hoopy frood
Joined: Sep 2003
Posts: 4,230 |
Not really a bug as it does what the help file says it does.
But i always thought a integer value was the next whole number below what ever number you have.
$int(%x) doesnt do this of course
|
|
|
|
Joined: Dec 2002
Posts: 2,962
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,962 |
Depends exactly what you mean by 'next whole number below what ever number you have'.
If you mean $int(56) should return 55 then no, that's not what an integer function should do. However, $int(55.99) should return 55 (and does) since all it's doing is ignoring the floating point part altogether.
If that's not what you mean then could you give an example?
Spelling mistakes, grammatical errors, and stupid comments are intentional.
|
|
|
|
Joined: Sep 2003
Posts: 4,230
Hoopy frood
|
OP
Hoopy frood
Joined: Sep 2003
Posts: 4,230 |
Sorry yes i shopuld have been more exact as to what it doesnt do.
And nope i wouldnt expect 56 to return 55, i ment to move down from any decimal part of a number to the next whole value, 56.000001=56 56=56 59.99999=59 but i would expect this to maintain to -34.4=-35
** remember here im not actually saying this is a bug - since the help does not say this is the nature of the command ** Rather I believe that is in fact what the integer of a value is, such as VB produces the next lower whole number
|
|
|
|
Joined: Jul 2003
Posts: 23
Ameglian cow
|
Ameglian cow
Joined: Jul 2003
Posts: 23 |
Well, for one thing, $int(-3.99) returns -3, whereas in maths |-3.99| would be -4 if I'm not mistaken...maybe that's what he means?
|
|
|
|
Joined: Aug 2003
Posts: 1,831
Hoopy frood
|
Hoopy frood
Joined: Aug 2003
Posts: 1,831 |
Maybe $floor is what you want.
|
|
|
|
Joined: Dec 2002
Posts: 2,962
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,962 |
Well although people generally say 'lower' they actually mean 'closer to zero'. This is the way that most computer languages calculate integers. I would assume that corresponds to the traditional mathematical definition for integers, but I really don't know for sure.
Spelling mistakes, grammatical errors, and stupid comments are intentional.
|
|
|
|
Joined: Dec 2002
Posts: 2,809
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,809 |
In math, |-3.99| = 3.99 (|x| is an absolute value). If you meant [-3.99] = -4 then yes you are correct, that would be -4. However, in programming, the int() function doesn't do this. It returns the "integer part" of the number. I think this is correct because mIRC does this with many identifiers. One example, $log. In math log() is base 10 and ln() is base e. In mIRC $log is base e. Again, in programming this is how it is, in C for example log() is base e and log10() is base 10. Seeing as how everywhere else mIRC follows the "programming" definition of the function, I think the way mIRC handles $int is correct.
IMHO the easiest way for this to be solved would be by adding $floor and $ceil to mIRC.
|
|
|
|
Joined: Aug 2003
Posts: 1,831
Hoopy frood
|
Hoopy frood
Joined: Aug 2003
Posts: 1,831 |
IMHO the easiest way for this to be solved would be by adding $floor and $ceil to mIRC. They have been added.
|
|
|
|
Joined: Jul 2003
Posts: 23
Ameglian cow
|
Ameglian cow
Joined: Jul 2003
Posts: 23 |
You're right. I always sucked at all those math symbols. Note that $floor and $ceil were added in mIRC 6.1
|
|
|
|
Joined: Sep 2003
Posts: 4,230
Hoopy frood
|
OP
Hoopy frood
Joined: Sep 2003
Posts: 4,230 |
VB makes it -4 cant think what some others do off the top of my head (actually i donty even have VB on this machine but im sure it does that), But im not complaining. Im just off now to bludgen my eyes out for not seeing thr $floor command on the line above $int in the help file.
|
|
|
|
Joined: Dec 2002
Posts: 2,809
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,809 |
Hmm, I'll take your word for it, I don't use 6.1 so I wouldn't know.
|
|
|
|
Joined: Dec 2002
Posts: 2,809
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,809 |
Yeah well that's cause VB is... well... VB. I'd never use VB as "the rule," I always consider what it does as the exception :P
|
|
|
|
|