# Trouble with pythagoras

**URL:** <https://forum.kirupa.com/t/trouble-with-pythagoras/21778>\
**Category:** Uncategorized\
**Created:** [May 26, 2003, 9:07am UTC](https://forum.kirupa.com/t/trouble-with-pythagoras/21778 "2003-05-26T09:07:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![xzyfer](https://avatars.discourse-cdn.com/v4/letter/x/ce73a5/32.png) [@xzyfer](https://forum.kirupa.com/u/xzyfer)\
**Post date:** [May 26, 2003, 9:07am UTC](https://forum.kirupa.com/t/trouble-with-pythagoras/21778/1 "2003-05-26T09:07:55Z")

</div>

i have inputs a,b,c.  
and im trying to use pythagoras on it…  
ive tried two formulas…  
both with this annoying result…  
it works perfectly teh first tym…  
but once i try to enter a different set of values i either get nothing or i get flash deleting the values ive inputted…  
is tehre a reason for this?  
here are my two formulas

* * *

## on (release) { // pythagoras if (!©){ c = Math.sqrt(Math.pow(a,2) + Math.pow(b,2)); } if (!(a)){ a = Math.sqrt(Math.pow(c,2) - Math.pow(a,2)); } if (!(b)){ b = Math.sqrt(Math.pow(c,2) - Math.pow(b,2)); } }

* * *

## on(release){ if (Number(a) != 0) { if (Number(b) != 0) { c = Math.sqrt((a_a)+(b_b)); } if (Number© != 0) { b = Math.sqrt((c_c)-(a_a)); } } if (Number(b) != 0) { if (Number(a) != 0) { c = Math.sqrt((a_a)+(b_b)); } if (Number© != 0) { a = Math.sqrt((c_c)-(b_b)); } } }

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 26, 2003, 4:13pm UTC](https://forum.kirupa.com/t/trouble-with-pythagoras/21778/2 "2003-05-26T16:13:40Z")

</div>

Maybe:

```auto
on (release) {
	// pythagoras
	var res;
	if (!c){
		res = Math.sqrt(Math.pow(a,2) + Math.pow(b,2));
		c = res;
	}
	if (!a){
		res = Math.sqrt(Math.pow(c,2) - Math.pow(a,2));
		a = res;
	}
	if (!b){
		res = Math.sqrt(Math.pow(c,2) - Math.pow(b,2));
		b = res;
	}
}

```

Couldn’t test it tough.
