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.

DarkBASIC Discussion / Problem with DBC V 1.08

Author
Message
Alien 001
19
Years of Service
User Offline
Joined: 4th Jul 2005
Location: Gateshead UK
Posted: 25th Aug 2006 14:23
THe other day i was working on an progress bar. and i found an bug with the math. I even check it in excel and it work. Here is the code.

Size = ( Current / Max ) * Width

IT was keep comming back with an 0. But i have found an way around the problem. Check the code.

Size# = ( CUrrent# / Max# ) * Width#

I used real number but dark basic does not have the function to change an integer to an real. so here it my code.

Function Int_Real( Number )
Return_Value# = val( str$( Number ) + ".0" )
endfunction Return_Value#

I can not remmber if there is an $ after the val command?
SimSmall
20
Years of Service
User Offline
Joined: 7th Aug 2004
Location: United Kingdom
Posted: 25th Aug 2006 15:10
Quote: "I can not remmber if there is an $ after the val command?"


definately not, $ is the type declaration character for the string data type. As you have demonstrated, # is the TDC for a float (real, whatever). and the character for an integer is... nothing...

There would only be a $ after the val if was a user-made function

Login to post a reply

Server time is: 2025-05-25 21:51:35
Your offset time is: 2025-05-25 21:51:35