Jay Mize wrote:This is my code, I want it to print y2 as 0.00 instead of -0.00 when y1 = 0.00
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
It does happen occasionallyWinston Gutkowski wrote: . . . First, I completely agree with Campbell: . . .
Jay Mize wrote:Thank you for the formating tips. The value of "r" suppose to be 1 sorry. The value of x1[index] for the last value is -1.00. "double y1 = Math.sqrt(Math.pow(r,2)-Math.pow(x1[index],2)); where "r" = 1" √(r^2)-(x1[index]^2). So r^2 = 1 , and x1[index]^2 = 1.00. Then 1-1 = 0. Wouldn't y1 be 0.00? Java is printing y1 = 2.1073424255447017E-8. Can someone tell me what does that mean? Thanks
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Jay Mize wrote:Thank you for the information Campbell and Fred. May I verify that if you do it with paper and pencil, √(1-1) is equal to 0? Just checking I'm not getting my math wrong.
Did you see how Paul cut 87% off of his electric heat bill with 82 watts of micro heaters? |