

distance Anonymous 
5 years

Hi.
I have two distances, x and y. As I can calculate the thrigonomic distance "a" of a triangle (a ^ 2 = x ^ 2 + y ^ 2) in VBScript?
Thanks



Steven from United States [1401 posts] 
5 years



Anonymous 
5 years

Thank you very much, Steven.
a = sqrt((x*x)+(y*y))  With this calculation goes the distance in millimeters. For example, 455.67544
and
a = (sqrt((x*x)+(y*y)))/1000  With this calculation goes the distance in meters. For example, 0.45567544
This two numbers see in screen when to active module "watch variables".
Now, how I can remove this decimal number (0.45567544) and the result is 0.4?



Steven from United States [1401 posts] 
5 years

You almost have it, using the CInt you can use
a = Cint((sqrt((x*x)+(y*y)))/100) / 10
The Cint rounds it to an integer and the last /10 gets it back to a single decimal place.
STeven.

