Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Programming Talk / Delphi - Extended to integer converting.. how?

Author
Message
Sergey K
21
Years of Service
User Offline
Joined: 4th Jan 2004
Location:
Posted: 7th Jan 2006 13:38
hey all, im trying to make a small distance formula in delphi with SQRT command
well, this SQRT command can return only Extended. so how do i convert that Extended to integer?

Just. ...Leave me alone =/
hyrichter
21
Years of Service
User Offline
Joined: 15th Feb 2004
Location: Arizona
Posted: 7th Jan 2006 14:14
Why on earth would you want to return the square root of a number as an integer? For example, take the square root of 8. It's something like 2.8284271....
But if you must know, the function is simply int(). However, that will just rip off whatever decimal part the number has. So int(4.99999) would return 4. If you want to round to the nearest integer, use the round() function. BTW, the F1 key is your best friend.

Sergey K
21
Years of Service
User Offline
Joined: 4th Jan 2004
Location:
Posted: 7th Jan 2006 14:20 Edited at: 7th Jan 2006 14:30
well. its my distance formula
anyhow, i found the problem
i need to use Round() command for that

(and thx for the tip )

Just. ...Leave me alone =/

Login to post a reply

Server time is: 2025-06-20 05:13:55
Your offset time is: 2025-06-20 05:13:55