patch 9.1.1684: min()/max() does not handle float data types

Problem:  min()/max() does not handle float data types
          (ubaldot)
Solution: Extend min() and max() to every comparable type
          (LemonBoy)

Re-use the logic used for plain old comparison operators, this way we
gain support for float values and unify the logic handling the
comparisons.

fixes: #18052
closes: 18055

Signed-off-by: LemonBoy <thatlemon@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
LemonBoy
2025-08-24 13:09:04 +02:00
committed by Christian Brabandt
parent b922b30cfe
commit 3b3b936125
13 changed files with 167 additions and 145 deletions

View File

@ -1,4 +1,4 @@
*builtin.txt* For Vim version 9.1. Last change: 2025 Aug 23
*builtin.txt* For Vim version 9.1. Last change: 2025 Aug 24
VIM REFERENCE MANUAL by Bram Moolenaar
@ -7626,7 +7626,7 @@ max({expr}) *max()*
Can also be used as a |method|: >
mylist->max()
<
Return type: |Number|
Return type: any, depending on {expr}
menu_info({name} [, {mode}]) *menu_info()*
@ -7718,7 +7718,7 @@ min({expr}) *min()*
Can also be used as a |method|: >
mylist->min()
<
Return type: |Number|
Return type: any, depending on {expr}
mkdir({name} [, {flags} [, {prot}]]) *mkdir()* *E739*

View File

@ -1,4 +1,4 @@
*version9.txt* For Vim version 9.1. Last change: 2025 Aug 23
*version9.txt* For Vim version 9.1. Last change: 2025 Aug 24
VIM REFERENCE MANUAL by Bram Moolenaar
@ -41752,6 +41752,7 @@ Others: ~
feature, see |socketserver-clientserver|.
- |CmdlineLeave| sets |v:char| to the character that caused exiting the
Command-line.
- |min()|/|max()| can handle all comparable data types.
Platform specific ~
- MS-Winodws: Paths like "\Windows" and "/Windows" are now considered to be