[Fixed] Min() and Max() always returns double (POL097-2008-02-26

Bug Reports relating to the 097 core are moved to this forum once solved.

Moderator: POL Developer

Locked
User avatar
ncrsn
Grandmaster Poster
Posts: 255
Joined: Fri Feb 10, 2006 12:15 am

[Fixed] Min() and Max() always returns double (POL097-2008-02-26

Post by ncrsn » Sun Mar 09, 2008 9:08 pm

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: Select all

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).

Demostenes
New User
Posts: 24
Joined: Wed Aug 29, 2007 2:44 pm
Contact:

Post by Demostenes » Mon Mar 10, 2008 10:11 am

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.

User avatar
ncrsn
Grandmaster Poster
Posts: 255
Joined: Fri Feb 10, 2006 12:15 am

Post by ncrsn » Tue Mar 11, 2008 12:47 am

"[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.

User avatar
CWO
POL Expert
Posts: 1151
Joined: Sat Feb 04, 2006 5:49 pm
Location: Chicago, IL USA

Post by CWO » Tue Mar 11, 2008 1:06 am

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.

MuadDib
Former Developer
Posts: 1090
Joined: Sun Feb 12, 2006 9:50 pm
Location: Cross Lanes, WV

Re: Min() and Max() always returns double (POL097-2008-02-26)

Post by MuadDib » Tue Dec 30, 2008 10:36 am

Code: Select all

08-28 Turley:
        Fixed : math::Min()/Max() now returns Integer/Double based on params

Locked