daniel02 Posted April 8, 2009 Share Posted April 8, 2009 Hi all, I just wanted to use the _Max. In my opinion the follwoing example should return 0 as the values are the same and there is no higher one. But it returns 11. I think this is a bug... If you do the same with _Min it returns 0. Or did i get something wrong? $max= _Max (11, 11) From Autoit Helpfile ##################### _Max -------------------------------------------------------------------------------- Evaluates which of the two numbers is higher. #include <Math.au3> _Max ( $nNum1, $nNum2 ) Parameters $nNum1 First number. $nNum2 Second number. Return Value Success: Returns the higher of the two numbers. Failure: Returns 0. @Error: 0 = No error. 1 = $nNum1 isn't a number. 2 = $nNum2 isn't a number. Remarks This function works with floats as well as integers. Link to comment Share on other sites More sharing options...
KaFu Posted April 8, 2009 Share Posted April 8, 2009 (edited) Hmmm, both functions return 11 for me. #include <math.au3> ConsoleWrite("_max(11,11) = " & _max(11,11) & @crlf) ConsoleWrite("_min(11,11) = " & _min(11,11) & @crlf) If you look into the source of math.au3 it's quiet clear why, both functions contain this code If $nNum1 > $nNum2 Then Return $nNum2 Else Return $nNum1 EndIf And from a logical standpoint I can't see no bug, as both results are valid imho. What might need a correction is the help-file, as the functions do not return the higher and lower values, but as the function names imply the maximum and minimum value ... Edited April 8, 2009 by KaFu OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
daniel02 Posted April 9, 2009 Author Share Posted April 9, 2009 If it both returns 11 I agree I have to check again because I think it returns in my script for max the value and for min zero. If you change of course the helpfile there is no bug But at the moment what I understand from the helpfile is that 0 should return because there is no max vaule if they are the same. Link to comment Share on other sites More sharing options...
PsaltyDS Posted April 9, 2009 Share Posted April 9, 2009 If it both returns 11 I agree I have to check again because I think it returns in my script for max the value and for min zero. If you change of course the helpfile there is no bug But at the moment what I understand from the helpfile is that 0 should return because there is no max vaule if they are the same.That is not the plain meaning of the help file as it stands. Return = 0 only on failure, and @error explains the conditions considered failures: Return ValueSuccess: Returns the higher of the two numbers. Failure: Returns 0. @Error: 0 = No error. 1 = $nNum1 isn't a number. 2 = $nNum2 isn't a number.The help file cannot account for every possible poor reading of plain language. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
KaFu Posted April 9, 2009 Share Posted April 9, 2009 (edited) If it wouldn't have been for the poor speaking part... If it would return the higher, it should return an error, because there is no higher in _max(11,11)..._MaxSuccess: Returns the maximum positive value of the two numbers. Edited April 9, 2009 by KaFu OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
youknowwho4eva Posted April 9, 2009 Share Posted April 9, 2009 Is 11 not the maximum? If you have a set of numbers, and the highest number appears more than once, I think your teacher would slap you if you wrote 0 or error as the answer Giggity Link to comment Share on other sites More sharing options...
PsaltyDS Posted April 9, 2009 Share Posted April 9, 2009 If it wouldn't have been for the poor speaking part... If it would return the higher, it should return an error, because there is no higher in _max(11,11)...That deserves a Valik-like response that I haven't the skill with vulgarity to pen here. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
KaFu Posted April 9, 2009 Share Posted April 9, 2009 (edited) Is 11 not the maximum? If you have a set of numbers, and the highest number appears more than once, I think your teacher would slap you if you wrote 0 or error as the answerIn fact, if my teacher would have asked me (in 1st class?) which one is higher, i would've answered none of both...Success: Returns the higher of the two numbers.I refer to PsaltyDS's comment for the rest...PsaltyDS, i've read enough of your posts over the years to highly regard your contribution to Au3 and this forum, but a reply like thisThe help file cannot account for every possible poor reading of plain language.which clearly is NOT true (otherwise Valik would already have kicked in), to a topic on page 2, on which the OP was thoroughly satisfied with, which would already have gone down the road to oblivion by now without your response, is not what I've become to know of you. Enough... Edited April 9, 2009 by KaFu OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now