PDA

View Full Version : Square root flash calculator



Matt da best
May 8th, 2009, 07:34 PM
Is there a simple way of pressing a button on a flash calculator to calculate the square root (sqrt)? I cant find anything about it.

for example



// Tangent of the angle in degree

function Dotan () {
if (display == 90) {
display = "Infinity";
} else {
display = Math.tan((display*Math.PI/180));
}
refresh();
}



//On release function

on (release) {
if(off_flag==false) {
if (setflag == true) {
display_flag = 0;
Status = "atan";
Doatan();
} else {
display_flag = 0;
Dotan();
Status = "tan";
}
}

}

But with sqrt?
Thank you for any help

glosrfc
May 8th, 2009, 08:13 PM
Math.sqrt

Matt da best
May 9th, 2009, 01:01 PM
Math.sqrt

What would you just replace the Math.tan with "Math.sqrt" or would it take other actionscript to do this? How would you do the percent as well?

neilmmm
May 9th, 2009, 06:19 PM
Math.sqrt finds the square root


var squareRoot=Math.sqrt(9);
trace(squareRoot);

traces 3

Matt da best
May 17th, 2009, 04:30 PM
Math.sqrt finds the square root


var squareRoot=Math.sqrt(9);
trace(squareRoot);

traces 3

Thanks so much