Greg Hauptmann
Registered User
Join date: 30 Oct 2005
Posts: 283
|
03-28-2006 17:01
Interesting, I just noted a case I have where Integer/Integer gives 0, but Integer/(float)Integer works? Specifically:
llCeil(llStringLength(message) / (float)dataLen) ==> WORKS (as I want it to) ==> lslint.exe reports this as an error "ERROR:: (164, 46): Invalid operator: integer / float"
llCeil(llStringLength(message) / dataLen) ==> gives 0 (not what I wanted) ==> lslint.exe reports no errors in this case
Is this expected operations? Seems to imply LL and lslint at the minimum aren't aligned? (I'll post this to the lslint thread too)
Cheers
|
Masakazu Kojima
ケロ
Join date: 23 Apr 2004
Posts: 232
|
03-28-2006 17:11
integer/integer will do integer division. For example, 3/4 will be 0, and llCeil(0) is 0. integer/float will do float division, so 3/4.0 will be 0.75, and llCeil(0.75) will be 1.
|
Feynt Mistral
Registered User
Join date: 24 Sep 2005
Posts: 551
|
03-29-2006 01:42
However as a contradiction to this, I've recently attempted the following code snippet: float number = 1 / (float)message;
And though message (a string) was 1234, the result was 0. <shrugs>
|
Seifert Surface
Mathematician
Join date: 14 Jun 2005
Posts: 912
|
03-29-2006 01:47
I just stick a (float) in front of everything if I expect a non-integer answer.
(Well, everything that isn't already a float)
_____________________
-Seifert Surface 2G!tGLf 2nLt9cG
|