mIRC Home    About    Download    Register    News    Help

Print Thread
#53012 08/10/03 11:09 PM
Joined: Sep 2003
Posts: 4,230
D
DaveC Offline OP
Hoopy frood
OP Offline
Hoopy frood
D
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

#53013 08/10/03 11:21 PM
Joined: Dec 2002
Posts: 2,962
S
Hoopy frood
Offline
Hoopy frood
S
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.
#53014 08/10/03 11:36 PM
Joined: Sep 2003
Posts: 4,230
D
DaveC Offline OP
Hoopy frood
OP Offline
Hoopy frood
D
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

#53015 08/10/03 11:36 PM
Joined: Jul 2003
Posts: 23
R
Ameglian cow
Offline
Ameglian cow
R
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?

#53016 08/10/03 11:46 PM
Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
Maybe $floor is what you want. smile

#53017 08/10/03 11:52 PM
Joined: Dec 2002
Posts: 2,962
S
Hoopy frood
Offline
Hoopy frood
S
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.
#53018 08/10/03 11:52 PM
Joined: Dec 2002
Posts: 2,809
C
Hoopy frood
Offline
Hoopy frood
C
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.

#53019 08/10/03 11:56 PM
Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
Quote:
IMHO the easiest way for this to be solved would be by adding $floor and $ceil to mIRC.
They have been added. laugh

#53020 08/10/03 11:56 PM
Joined: Jul 2003
Posts: 23
R
Ameglian cow
Offline
Ameglian cow
R
Joined: Jul 2003
Posts: 23
You're right. I always sucked at all those math symbols. smile

Note that $floor and $ceil were added in mIRC 6.1

#53021 09/10/03 12:02 AM
Joined: Sep 2003
Posts: 4,230
D
DaveC Offline OP
Hoopy frood
OP Offline
Hoopy frood
D
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.

#53022 09/10/03 02:48 AM
Joined: Dec 2002
Posts: 2,809
C
Hoopy frood
Offline
Hoopy frood
C
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.

#53023 09/10/03 02:49 AM
Joined: Dec 2002
Posts: 2,809
C
Hoopy frood
Offline
Hoopy frood
C
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


Link Copied to Clipboard