It is currently Wed Oct 15, 2008 11:19 am

All times are UTC - 8 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Min() and Max() always returns double (POL097-2008-02-26)
PostPosted: Sun Mar 09, 2008 9:08 pm 
Offline
User avatar

Joined: Fri Feb 10, 2006 12:15 am
Posts: 223
Regardless of the types of the variables passed in function Min() or Max(), the value returned is always double.

Using following code you can see it by yourself.

Code:
var x := 1;
var y := 2;

Print("Type of x: " + TypeOf(x) + ", type of y: " + TypeOf(y)); // -> integer, integer

var maxxy := Max(x, y);
var minxy := Min(x, y);

Print("Return value of maxxy: " + maxxy + ", type of maxxy: " + TypeOf(maxxy)); // -> 2, double
Print("Return value of minxy: " + minxy + ", type of minxy: " + TypeOf(minxy)); // -> 1, double


Also the documentations have errors in it, as the mentioned functions are told to return integer.

This is very annoying bug because before this release, we already had our own Min and Max functions that worked correctly, and because of this bug we should have integer conversations in places never needed it before, resulting weird behaviour in some scripts.

As a feature request I wish Min() and Max() would not change the type of the larger or smaller value at all: so if 0 (integer) and 2.2 (double) is passed to Max(), it would return 2.2 (double), and if they are passed in Min(), it would return 0 (integer).


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 10, 2008 10:11 am 
Offline

Joined: Wed Aug 29, 2007 2:44 pm
Posts: 24
The newest release is one big surprise. There was much more changes, than is written in change.log, so since release, we are still discovering, how much things stopped working and why.
For exaxmple yesterday we were fixing some problem and to 4 o'clock in the morning trying to discover, why our in-game html help stopped working properly since new core. After some time, we found out, that there some forbidden chars in unpack function (or more precisely aux connection)
now.....
I have nothing against changes, but they should be documented.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 11, 2008 12:47 am 
Offline
User avatar

Joined: Fri Feb 10, 2006 12:15 am
Posts: 223
"[Changes] should be documented."
So should be the bugs.

I bet there are many core bugs discovered times ago that are either never reported or just forgotten because of a new core release.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 11, 2008 1:06 am 
Offline

Joined: Sat Feb 04, 2006 5:49 pm
Posts: 772
Location: Chicago, IL USA
You might even see it in your own scripts sometimes too... Changing certain things might affect other things on your shard even if they seem unrelated to your players. Only you would know if you knew your scriptbase completely how they would be related. Same thing can happen with core devs developing the core.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Style based on FI Subice by phpBBservice.nl