Created
January 15, 2010 01:20
-
-
Save gerardpaapu/277693 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Javascript | |
function triangle(a,b) { | |
if(a > 0 && b > 0 ) { | |
function sqroot(x) { | |
return (x > 0) ? Math.pow(x,.5) : 0; | |
} | |
return sqroot( a*a + b*b ); | |
} else return 0; | |
} | |
// mozilla specific | |
function triangle(a,b) { | |
if(a > 0 && b > 0 ) { | |
function sqroot(x) (x > 0) ? Math.pow(x,.5) : 0; | |
return sqroot( a*a + b*b ); | |
} else return 0; | |
} | |
// trimmed mozilla | |
function triangle(a,b) { | |
if (a < 0 || b < 0 ) return 0; | |
function sqroot(x) (x > 0) ? Math.pow(x,.5) : 0; | |
return sqroot( a*a + b*b ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment