Kiti Posted July 3, 2008 Share Posted July 3, 2008 (edited) I have two questions about numbers. The first question is: How can I determine which is the smallest number from a group of three, aside from: If $n1 < $n2 and $n1 < $n3 Then $smallest = $n1 EndIf If $n2 < $n1 and $n2 < $n3 Then $smallest = $n2 EndIf If $n3 < $n1 and $n3 < $n2 Then $smallest = $n3 EndIfoÝ÷ Ø ÝjÈyúèf¤x-çb}÷«zwjwb~+wöǪ¹©m£Kazz窹©b~+wöË&jY^®ØZKayø«²ÙèË&jY^©ÝøßÛ%j¸®ØZKazÇ¢wg¢+,©ez²,¶«y©ò¢Ø^ö¬µê梷¬jey©Ýn襶)æzØhvX¤y«¢+ØÀÌØíMµ±±Èô9ÕµÉM±ÑMµ±±È ÀÌØí¸Ä°ÀÌØí¸È°ÀÌØí¸Ì ? And the second: I divide to integrers. The result can be of any kind: integrer, real number, zecimal number etc. How can I get everytime only the first digit and the next 2 zecimal digits? Thank you in advance! Edited July 3, 2008 by Kiti Think outside the box.My Cool Lego Technic Website -- see walking bipeds and much more!My YouTube account -- see cool physics experimentsMy scripts:Minesweeper bot: Solves advanced level in 1 second (no registry edit), very improved GUI, 4 solving stylesCan't go to the toilet because of your kids closing your unsaved important work? - Make a specific window uncloseableCock Shooter Bot -- 30 headshots out of 30 Link to comment Share on other sites More sharing options...
Andreik Posted July 3, 2008 Share Posted July 3, 2008 I have two questions about numbers. The first question is: How can I determine which is the smaller number from a group of three, aside from If $n1 < $n2 and $n1 < $n3 Then $smallest = $n1 EndIf If $n2 < $n1 and $n2 < $n3 Then $smallest = $n2 EndIf If $n3 < $n1 and $n3 < $n2 Then $smallest = $n3 EndIf Like this: #include <Math.au3> $Min = _Min(_Min($nNum1,$nNum2),$nNum3) When the words fail... music speaks. Link to comment Share on other sites More sharing options...
Xenobiologist Posted July 3, 2008 Share Posted July 3, 2008 Hi, put them into an array and then _arrayMin Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
Kiti Posted July 3, 2008 Author Share Posted July 3, 2008 Thank you very much andreik !! What about the 3 digits in any number? Can _arraytrimleft also return what it has trimmed? or maybe trim 4 character, add "0.00" and then make the division? $no = 2.34765457 $no1 = StringTrimLeft($no, 4) ;=>$no1 = 765457 $no2 = "0.00" & $no1 ;=>$no2 = 0.00765457 $result = $no-$no2 ; ;=> $result = 2.34765457-0.00765457=2.34 Any other more direct method ? muttley Think outside the box.My Cool Lego Technic Website -- see walking bipeds and much more!My YouTube account -- see cool physics experimentsMy scripts:Minesweeper bot: Solves advanced level in 1 second (no registry edit), very improved GUI, 4 solving stylesCan't go to the toilet because of your kids closing your unsaved important work? - Make a specific window uncloseableCock Shooter Bot -- 30 headshots out of 30 Link to comment Share on other sites More sharing options...
Andreik Posted July 3, 2008 Share Posted July 3, 2008 Thank you very much andreik !! What about the 3 digits in any number? Can _arraytrimleft also return what it has trimmed? or maybe trim 4 character, add "0.00" and then make the division? $no = 2.34765457 $no1 = StringTrimLeft($no, 4) ;=>$no1 = 765457 $no2 = "0.00" & $no1 ;=>$no2 = 0.00765457 $result = $no-$no2 ; ;=> $result = 2.34765457-0.00765457=2.34 Any other more direct method ? muttleyTry this: Func MyFunc($NUM) If IsInt($NUM) Then Return $NUM Else $LEN = StringLen(String($NUM)) $POINT = StringInStr(String($NUM),".") Return StringLeft(String($NUM),$POINT + 2) EndIf EndFunc When the words fail... music speaks. Link to comment Share on other sites More sharing options...
Kiti Posted July 3, 2008 Author Share Posted July 3, 2008 Try this: Func MyFunc($NUM) If IsInt($NUM) Then Return $NUM Else $LEN = StringLen(String($NUM)) $POINT = StringInStr(String($NUM),".") Return StringLeft(String($NUM),$POINT + 2) EndIf EndFunc Yayy!!! That's just perfect! Thank you very much! muttley Think outside the box.My Cool Lego Technic Website -- see walking bipeds and much more!My YouTube account -- see cool physics experimentsMy scripts:Minesweeper bot: Solves advanced level in 1 second (no registry edit), very improved GUI, 4 solving stylesCan't go to the toilet because of your kids closing your unsaved important work? - Make a specific window uncloseableCock Shooter Bot -- 30 headshots out of 30 Link to comment Share on other sites More sharing options...
Andreik Posted July 3, 2008 Share Posted July 3, 2008 (edited) Yayy!!! That's just perfect! Thank you very much! muttley Func MyFunc($NUM,$DIGIT) If IsInt($NUM) Then Return $NUM Else $LEN = StringLen(String($NUM)) $POINT = StringInStr(String($NUM),".") Return StringLeft(String($NUM),$POINT + $DIGIT) EndIf EndFunc MsgBox(-1,"",MyFunc(Random(1,1000),3)) If you want more zecimal digits after point. Edited July 3, 2008 by Andreik When the words fail... music speaks. Link to comment Share on other sites More sharing options...
Xenobiologist Posted July 3, 2008 Share Posted July 3, 2008 Round??? Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
Andreik Posted July 3, 2008 Share Posted July 3, 2008 (edited) Round???Yes. And more quick Round function. I don't use this function yet. muttley Edited July 3, 2008 by Andreik When the words fail... music speaks. 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