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 Professional Discussion / Calculating an equation in DBP - brains needed!

Author
Message
Lampton Worm
22
Years of Service
User Offline
Joined: 4th Sep 2002
Location: United Kingdom
Posted: 20th Mar 2004 16:38 Edited at: 20th Mar 2004 17:05
Hi,

I've written a few calcuators for software metrics, effort etc. and at the moment I'm trying to write a small utility to calculate Putnam's software equation, but I'm not quite sure how best to represent this in my code. Math isn't my strong point, and the stuff I've done so far is fairly simple, but for this one any brians out there want to give me some advice? I'm sure its not as bad as it looks, but Algebra isn't my strong point

The equation is...

E = [LOC x B 0.333 / P]3 x (1/t4)

The user will input LOC, B, P and t. LOC, P and t are integers, B is a float with a possible range of 0.16 to 0.39... my first attempt went bang becuase I had difficulty using input to enter a float, then converting that string into a real number. I sorted of needed a float(string) command, a bit like int(string), unless I'm doing that all wrong

[edit] actually, I think t needs to be a float.

So, the idea so far once I had the data entered (using test date for now), to do something like, E#=(loc*(b#*0.333)/P) for the first bit then 3*(1/(t*4)) for the next part... but I imagine EXP() could be used.

Cheers in advance.
kevil
22
Years of Service
User Offline
Joined: 24th Nov 2002
Location: Netherlands
Posted: 20th Mar 2004 17:37
I have no idea what you are trying to do. Maybe you could explain it a little bit easier? I don't see what your problem is.

Kevil
Lampton Worm
22
Years of Service
User Offline
Joined: 4th Sep 2002
Location: United Kingdom
Posted: 20th Mar 2004 18:37
Hi,

I guess I don't fully understand the formula, and until I do I can't code it. Maybe this needs moving to the general General section while I have a few math lessons (its been a while)... For background on what I'm trying to do, check here...

http://www.google.co.uk/search?q=cache:F3az7TS8o5cJ:www.ceng.metu.edu.tr/~dogru/se2.pdf+software+equation+effort+LOC&hl=en&ie=UTF-8

Near the bottom, Putnam's Software Equation. Trying to write a sort of wizard to work out the effort in person months. Obviously this can be done on a calc, but that's no fun.

Cheers.
zircher
22
Years of Service
User Offline
Joined: 27th Dec 2002
Location: Oklahoma
Posted: 20th Mar 2004 22:10 Edited at: 21st Mar 2004 02:53
Since floats can store whole numbers, declare everything as a float and that will make your life easier.

Does this look right to you?

E# = ((LOC# * B# * 0.333) / P#) * 3 * (1/(t * 4))

Use parenthesis libererally to simplify the expression.
--
TAZ

The Real 87
21
Years of Service
User Offline
Joined: 3rd Mar 2004
Location: somewhere between 86 and 88
Posted: 21st Mar 2004 02:26
the double parenthesis are not need the order of opperations will do it in that order with out needing to be told

Badger badger badger badger badger
Mushroom mushroom
zircher
22
Years of Service
User Offline
Joined: 27th Dec 2002
Location: Oklahoma
Posted: 21st Mar 2004 03:05
True, but a few bytes wasted in the source code to improve grouping and legibility are well worth the expense in my book.
--
TAZ

Lampton Worm
22
Years of Service
User Offline
Joined: 4th Sep 2002
Location: United Kingdom
Posted: 21st Mar 2004 12:56
Ah, that's looking good - thanks. Good point on declaring everything as floats..also I don't mind the double parenthesis, easy to read when I look back on it later.

Living and learning,
Cheers.
ZomBfied
22
Years of Service
User Offline
Joined: 2nd Oct 2002
Location:
Posted: 22nd Mar 2004 21:13
I'm with you. I use parentheses all the time even when I don't have to.

Login to post a reply

Server time is: 2025-06-10 05:20:56
Your offset time is: 2025-06-10 05:20:56