AutoHotkey Community

It is currently May 27th, 2012, 1:12 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: May 22nd, 2008, 7:59 am 
For the love of god I have no idea why none of these work. I'm just trying to get 0.75 out of 3/4

var1 := 3/4
var1 := Round(3/4,2)

What am I doing wrong????????


Report this post
Top
  
Reply with quote  
PostPosted: May 22nd, 2008, 8:53 am 
You apparently did nothing wrong...

Code:
var1 := 3/4
var2 := Round(3/4,2)
msgbox, var1(%var1%)`nvar2(%var2%)
;//---------------------------
;//test.ahk
;//---------------------------
;//var1(0.750000)
;//var2(0.75)
;//---------------------------
;//OK   
;//---------------------------

...they both are 0.75, but var1 has some extra 0's...

But how were you checking the value to think it wasn't working?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: May 22nd, 2008, 9:12 am 
You can get rid of any padding by SetFormat:
Code:
SetFormat, Float, 0.2
MsgBox % 3/4


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: May 22nd, 2008, 9:46 am 
I'm trying to do a loop twice...

Code:
stat%A_Index% := %stat%


where the current stat in the loop is always a fraction and I keep getting the error the the fraction is an illegal character or something.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: May 22nd, 2008, 9:47 am 
or if I do Round(stat,2) it only comes out with the numerator of the fraction...


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Amandaville, Bing [Bot], BrandonHotkey, chaosad, Google [Bot] and 22 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group