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.

Author
Message
Surreal Studio IanG
22
Years of Service
User Offline
Joined: 21st Sep 2003
Location: Cyberspace...I think
Posted: 19th Nov 2003 19:54
Is it possible for DBPro to detect a decimal?

Flick that switch...*BANG*...Not that one!
CattleRustler
Retired Moderator
22
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 19th Nov 2003 20:35
do you mean Float variable type?

an integer is like 123
a float is like 123.112233

-RUST-
Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 19th Nov 2003 23:31
I was just wondering yesteday if there's a way to determine if a number is real or not. Hmm, I think I could write a quick function.

function isReal(number)
int_number = int(number)
if (number % int_number) = 0 endfunction 0
endfunction 1
Rob K
Retired Moderator
23
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 19th Nov 2003 23:55 Edited at: 19th Nov 2003 23:58
The easiest method would be to convert the unknown number to an integer and check to see if it matches the original number.




BLUE GUI Plugin: http://blue.robert-knight.net / BLUE IDE [href]http://blueide.sf.net/ - Replacement editor for DBPro[/href]
CattleRustler
Retired Moderator
22
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 20th Nov 2003 00:59
or convert the number to a string and see if it contains a "."

-RUST-
Surreal Studio IanG
22
Years of Service
User Offline
Joined: 21st Sep 2003
Location: Cyberspace...I think
Posted: 21st Nov 2003 19:02
@ cattleruster: I'll try that

@everyone else: what i want to use it for is pythagorean triples (three integers that work with Pythagoreas' theorm) so i cant check whether it matches the original.

thanks for your help

Flick that switch...*BANG*...Not that one!

Login to post a reply

Server time is: 2026-07-26 15:30:18
Your offset time is: 2026-07-26 15:30:18