Questions tagged [hypotenuse]

22 questions
0
votes
1 answer

Returning function values as float Python 3.6.1

I get the following error and can't seem to figure out how to fix. Following the logic, i'm calling 3 functions and all 3 return values as float and then I'm performing some math operation on the stored returned values and print it as float. So…
Cornel
  • 180
  • 2
  • 4
  • 13
0
votes
0 answers

Swift - CGVector and Hypot() function

I needed to compare speeds in my game therefore I used an extension to declare the '>' and '<'symbols. My code is seen below: extension CGVector { var speed: CGFloat { return hypot(dx, dy) } static func > (lhs: CGVector, rhs: CGVector) -> Bool…
user6361496
0
votes
2 answers

C++ Creating function to draw the hypotenuse - Trigonometry

I understand how to calculate the hypotenuse a^2 + b^2 = c^2, sqrt(c) = hypotenuse. And I am aware there are some relevant answers already on stackoverflow, but they are immersed in terminology I don't understand(yet) as a beginner programmer. As…
Cameron P
  • 57
  • 6
0
votes
1 answer

Hypotenuse using function & Math.sqrt() javascript

Hello I am doing this function calculating the hypotenuse. here the code I created so far. I have to use the Math.sqrt() method which is a part of the requirement. Once the code is running nothing occurs. Thanks for your help guys! function…
Max59430
  • 13
  • 1
  • 2
0
votes
1 answer

calculating distance between clicks with hypotenuse

I have some code which calculates the position of an object when clicked and moved, but now I need to find the distance between clicks- for example, how far the object moves the next time I click it. I know it involves calculating the hypotenuse,…
-2
votes
1 answer

Unit Vector Function

I am trying to calculate the unit vector in R², using JavaScript. I expected an output of 1, but I get 1.949.6. what did I miss in this implementation? function calcHypotenuse(a, b) { return (Math.sqrt((a * a) + (b * b))); } …
Stacky
  • 3
  • 5
-2
votes
1 answer

NEED HELP: Computer Science 101 HW/JAVA

I wrote the code for the problem in the title and seem to be having some problems. Can anyone give me some insight or tips on what I am doing wrong. Especially with the "if...else" portion of the code. Here is the question #9. If you click the…
zhughes3
  • 467
  • 10
  • 22
1
2