PDA

View Full Version : computing distance


sidny4
10-21-2006, 10:57 AM
I have to compute the distance between two points entered by the user. I have already made the 4 points (x1, x2, y1, y2) and have them set to whatever the user enters. Now I just need to compute the distance which should be (x1-x2)^2 + (y1-y2)^2. Any ideas as to how to do this?

Clunk
10-21-2006, 04:57 PM
go to world functions and scroll down to advanced math
you should be able to use those

use Print for your answer

with a test world i created, it seems that it always truncates so the answer wont be accurate unless someone comes here and can fix that :P

DrJim
10-22-2006, 07:05 PM
Can you post the code (or the world) that's giving you the truncation problem? I've done a half dozen tests and haven't seen any real truncation issue (Alice will drop trailing zero's but that won't affect accuracy). :confused: Usually I see the opposite problem, Alice will print all twenty digits or so of a double precision number (the basic Alice format) when really only the first two or three digits are significant, but the very last digit after the decimal place is a one or two.