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.

Newcomers DBPro Corner / simple divison

Author
Message
Drunken French Munk
20
Years of Service
User Offline
Joined: 4th May 2004
Location: 3rd planet, sol system, alpha quadrent..
Posted: 15th Mar 2005 00:38
hey every one,
ive been playing around with darkBASIC for awhile. I just now came across this problem. long story short i cant figure out how to conver fractions into decimals.
when i type
1/2 i should get .5
4/3 i should get 1.333333333333333333333333333333333
it just gives zero!
things that are simple like:
1/1
4/2
9/3
etec. are working. And yes i have tried adding a # to the end of my variables

This is my home Profile, im AKA DBasic Kahn

"Poor guys, they had US surrounded"- US 101st Paratrooper at the Battle of the Buldge"
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 15th Mar 2005 00:56 Edited at: 15th Mar 2005 00:56
At least one of the operators in the equation have to have a .0 at the end or be a float variable to divide into a float result.





Coding Fodder
21
Years of Service
User Offline
Joined: 25th Sep 2003
Location: Somewhere in my cerebralcortex
Posted: 15th Mar 2005 08:54
if you are saving the result to a variable it must be a floating point variable



The # at the end declares it a float

You probably knew that but I still sometimes forget to add it in and wonder why my code is all screwed up

Something really catchy that makes people stop and think about the meaning of life and say to themselves "My but thats clever"

Login to post a reply

Server time is: 2024-11-13 20:01:20
Your offset time is: 2024-11-13 20:01:20