|
distance Anonymous |
11 year
|
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 Gentner from United States [1446 posts] |
11 year
|
|
|
Anonymous |
11 year
|
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 Gentner from United States [1446 posts] |
11 year
|
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.
|
|