# Square & Square Root

## Recommended Posts

Hey all,

Square of a number:

MsgBox(0, "Square", Sq(2))

Func Sq(\$io_snum)
Return \$io_snum ^ 2
EndFuncoÝ÷ Ø Ý²«­êè¢Ö®¶­sd×6t&÷ÂgV÷Cµ7V&R&ö÷BgV÷C²Â7&ö÷B" ¤gVæ27&ö÷Bb33c¶õ÷6çVÒ¢&WGW&âb33c¶õ÷6çVÒâãP¤VæDgVæ0

Thanks poisionkiller.

Simple, but would be good if it was in the Math functions, I need it a bit.

-James

Edited by JamesB

##### Share on other sites

Hey all,

Square root of a number:

MsgBox(0, "Square Root", SqRoot(2))

Func SqRoot(\$io_snum)
Return \$io_snum ^ 2
EndFunc

Simple, but would be good if it was in the Math functions, I need it a bit.

-James

It's returning the sqaure of the number, not the square root (2 yields 4, 4 yields 16, etc)

- MoChr(77)& Chr(97)& Chr(100)& Chr(101)& Chr(32)& Chr(121)& Chr(97)& Chr(32)& Chr(108)& Chr(111)& Chr(111)& Chr(107)-------I've told you 100,000 times not to exaggerate!-------Don't make me hit you with my cigarette hand...-------My scripts:Random Episode Selector, Keyboard MouseMover, CopyPath v2.1, SmartRename for XP,Window Tracer[sup]New![/sup]

##### Share on other sites

Oh right. I just found Sqrt Oh well.

##### Share on other sites

MsgBox(0, "Square Root", SqRoot(2))

Func SqRoot(\$io_snum)
Return \$io_snum ^ 0.5
EndFunc

This will calculate square root.

##### Share on other sites

Ahh right. Thanks poisionkiller

##### Share on other sites

And what's wrong with built-in function Sqrt()? ...

MsgBox(0, "Square Root", Sqrt(2) & @LF & SqRoot(2))

Func SqRoot(\$io_snum)
Return \$io_snum ^ 0.5
EndFunc

But it's good to know the custom way ... BTW: there is some topic in general help and support forum that ask about it...

Edited by MsCreatoR

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

My Work...

Spoiler

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating )

* === My topics === *

==================================================

==================================================

AutoIt is simple, subtle, elegant. © AutoIt Team

##### Share on other sites

Cool. Well I just found the Sqrt in the helpfile

## Create an account

Register a new account

×

• Wiki

• Back

• Git