Sign in to follow this  
Followers 0
Rad

Number() Does not solve my equation.

5 posts in this topic

$w = Number(1+2+10) ;returns 13

$x = Number("3.14") ;returns 3.14

$y = Number("24/7") ;returns 24

$z = Number("tmp3") ;returns 0

umm, right... I'm making a basic calculator for a demonstration for my friend. But what the hell?! If you press + it sets "$method[$currentmethod]" to +. Now, it has to be a "+" or else I get a syntax error. Now when I put $value[1] & $method[1] & $value[2] etc together it turns the mass into a string, then returns the first value. If I display the equation its all fine, but doesnt seem to work for as an equation... Is there any functionst to solve? Maybe I overlooked I checked the helpfile theres none like Equation() or Solve()...:/

Share this post


Link to post
Share on other sites



$test = Number(24/7)
$test2 = Int(24/7)
MsgBox(0, 'test', "If you don't have it in a string you get this: (" & $test & ")" & @CRLF & "Or you could simply make it an integer like this Int(24/7) if you don't want decimals (" & $test2 & ")")


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Hmm, that doesnt quite help because it makes it a string as I add every 'method' (+, -, *, /) to the equation...

And it takes the first number/int if its a string :o

(Another word for 'number' is real idk why it does have a real() function ;P)

Edited by Rad

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Can you provide a real code... what your actually doing? What returns a 'literal string'?

Edit:

You'll need beta for this:

$test = Execute("24/7")
MsgBox(0, 'test', "(" & $test & ")")
Edited by SmOke_N

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Ah thanks, that works great! Exactly what I needed, sorry I didnt come back for awhile my comp had a loading OS problem (which fixed itself?)... but yea, it works! Thanks

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0