REBOL3 tracker
  0.9.12 beta
Ticket #0001500 User: anonymous


Short URL:
TypeBug Statustested Date21-Feb-2010 10:54
Versionalpha 97 CategoryNative Submitted byhenrikmk
PlatformAll Severitytrivial Prioritynormal

Summary MAX/MIN change the datatype of the returned value
Description If an integer and decimal or money is combined, the output is decimal or money, but this is not stated in help. In a specific case, I wasn't expecting that, when a value suddenly changed from integer! to decimal!:

? max
MAX value1 value2

Returns the greater of the two values.
MAX is a native value.

value1 (scalar! date! series!)
value2 (scalar! date! series!)
Example code
>> max 4 2.5
== 4.0

>> max 4 $2.5
== $4

Assigned ton/a Fixed inalpha 108 Last Update20-Oct-2010 03:11

21-Feb-2010 22:06

It's changed for decimal! and money! comparison too:
>> max 4.0 $2.5
== $4.0000000000000000

In the hierarchy of integer!, decimal!, money! the higher type in the hierarchy is returned. I suspect that this is because the value needs to be converted to be compared, and the converted value is returned instead of the original. This should be either noted in the web docs or changed to return the original value, same as series.
22-Sep-2010 05:09

A nasty side-effect bug.

Date User Field Action Change
20-Oct-2010 03:11 BrianH Summary Modified MAX/MIN do not state in help that the datatype for an integer input is changed => MAX/MIN change the datatype of the returned value
20-Oct-2010 03:11 BrianH Category Modified Unspecified => Native
20-Oct-2010 03:11 BrianH Status Modified built => tested
22-Sep-2010 05:09 carl Comment : 0002528 Added -
22-Sep-2010 05:09 carl Fixedin Modified => alpha 108
22-Sep-2010 05:09 carl Status Modified submitted => built
21-Feb-2010 22:06 BrianH Category Modified Documentation => Unspecified
21-Feb-2010 22:06 BrianH Severity Modified text => trivial
21-Feb-2010 22:06 BrianH Status Modified reviewed => submitted
21-Feb-2010 22:06 BrianH Type Modified Note => Bug
21-Feb-2010 22:06 BrianH Comment : 0002041 Added -
21-Feb-2010 21:59 BrianH Description Modified -
21-Feb-2010 21:59 BrianH Code Modified -
21-Feb-2010 21:59 BrianH Category Modified Unspecified => Documentation
21-Feb-2010 21:59 BrianH Status Modified submitted => reviewed
21-Feb-2010 10:54 henrikmk Ticket Added -