Garrett19212 Posted August 12, 2005 Share Posted August 12, 2005 When I multply a number by 1 i get -1.#IND How can i make it successfully multply it by 1. Link to comment Share on other sites More sharing options...
w0uter Posted August 12, 2005 Share Posted August 12, 2005 did you do 0/0 ? My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll Link to comment Share on other sites More sharing options...
Garrett19212 Posted August 12, 2005 Author Share Posted August 12, 2005 What do you mean 0/0 here is an example of what i am doing. $var1 = $var1 * $var2 Var2 is a customizeable value, so lets say its 1 by default Then i make a label display $var1 it will display -1.#IND Link to comment Share on other sites More sharing options...
therks Posted August 12, 2005 Share Posted August 12, 2005 (edited) Firstly, you can do this instead.$var1 *= $var2Secondly, what does $var1 start as?$var1 = 2 $var2 = 1 $var1 *= $var2 msgbox(0,0,$var1)This works fine for me.*Edit: And what w0uter meant was did you divide by zero? (I guess he should have said #/0, # being any number) Anything divided by zero will give you the result you're getting. (Ooops, see correction#2)*Correction: Upon testing, I notice that anything divided by zero returns "1.#INF"I find -1.#IND in the helpfile under ACos, ASin, Log, and Mod.Are you using any of these functions in your script?*Correction#2: Er, uh.. nevermind, w0uter is right. 0/0 (zero divided by zero) will return -1.#IND. Anything ELSE divided by zero will return 1.#INF. My bad. Edited August 12, 2005 by Saunders My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
Garrett19212 Posted August 12, 2005 Author Share Posted August 12, 2005 No im not dividing by 0, nor am I using any of those functions. Link to comment Share on other sites More sharing options...
therks Posted August 12, 2005 Share Posted August 12, 2005 You still never said what $var1 starts as though. My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
Garrett19212 Posted August 13, 2005 Author Share Posted August 13, 2005 Iv been testing it as $var1 = 5 Link to comment Share on other sites More sharing options...
w0uter Posted August 13, 2005 Share Posted August 13, 2005 to save us all alot of time. post a small script that reproduces the problem. something like what saunders did. My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll Link to comment Share on other sites More sharing options...
therks Posted August 13, 2005 Share Posted August 13, 2005 (edited) Also: Did you try my example? Does it work?*Edit: What w0uter said, but you don't need to give us a 2 page script either. Just post a working example that gives you the error. And by working I mean one that you can copy and paste, add nothing to, and run and it will give you the same error. That way we can test the exact same thing. Edited August 13, 2005 by Saunders My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
Garrett19212 Posted August 13, 2005 Author Share Posted August 13, 2005 Im trying to get the error on a new script but I cant seem to get it, I have a ton of things that may affect it in script that is giving that error. So I don't know which things to copy. Link to comment Share on other sites More sharing options...
MSLx Fanboy Posted August 13, 2005 Share Posted August 13, 2005 In that case just post it as an attachment or the code itself (if its a relatively small script). Writing AutoIt scripts since _DateAdd("d", -2, _NowCalcDate()) Link to comment Share on other sites More sharing options...
Garrett19212 Posted August 13, 2005 Author Share Posted August 13, 2005 Here it is. Its a script that calculates damage, and damage reduction for warcraft 3. If you put 0 in armor points, you will get the error im talking about. Push enter to calculate the result.DamageCalculater1.zip Link to comment Share on other sites More sharing options...
Valik Posted August 13, 2005 Share Posted August 13, 2005 Anything multiplied by 0 is 0. $AttackR = $armorAm * 0.06 $AttackR2 = 1 + 0.06 * $armorAm Link to comment Share on other sites More sharing options...
Garrett19212 Posted August 13, 2005 Author Share Posted August 13, 2005 Anything multiplied by 0 is 0.$AttackR = $armorAm * 0.06 $AttackR2 = 1 + 0.06 * $armorAm0.06 isn't 0. Link to comment Share on other sites More sharing options...
Valik Posted August 13, 2005 Share Posted August 13, 2005 I never said it was. Link to comment Share on other sites More sharing options...
Jason_A Posted August 13, 2005 Share Posted August 13, 2005 (edited) Division by zero:$armorAm = GUICtrlRead($ArmorAmount) ; assume this is 0...$AttackR = $armorAm * 0.06 ; 0 * .06 = 0$AttackR2 = 1 + (0.06 * $armorAm) ; 1 + .06 * 0 = 1$AttackR = $AttackR / $AttackR2 ; $attackR = 0 / 1 = 0$AttackAvg2 = $AttackR ; AttackAvg2 = 0$AttackAvg2 = Round($AttackAvg2, 2) ; $AttackAvg2 = 0 (rounded)$AttackAvg2 = $AttackAvg2 * 100 ; $AttackAvg2 = 0 * 100 = 0$AttackAvg2 = $AttackAvg / $AttackAvg2 * 10 ; $AttackAvg2 = $AttackAvg / 0 * 10 = ($AttackAvg / 0) * 10 !ERROR!Since someone can (probably) have 0 armor points (if they're walking around naked, and aren't very hairy, I suppose), you will probably need to do an alternate calculation for that instance. Edited August 13, 2005 by Jason_A 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