Skip to main content
Inspiring
November 23, 2006
Question

to 4 decimal points

  • November 23, 2006
  • 37 replies
  • 4828 views
Ok i'm lost, even though I've asked this before.

I've got my file here http://home.exetel.com.au/twistedpancreas/images/test1.fla , calculating an equation.

But once again I need the answer to be to 4 decimal points (ie like an answer of 0.0393), but for the life of me I can't get it to work.

I tried *100 / 100 but i'm just confusing myself.

Sorry for my lack of knowledge, but i appreciate the help.
This topic has been closed for replies.

37 replies

Inspiring
December 19, 2006
> um i'm getting NaN when molInput.text = 0.0391 and titrationInput.text =
> 0.01630

Then there is something going on you're not telling us, as the script will
work with those inputs .. are you sure there.s not other characters in the
strings?
--
Jeckyl


Inspiring
December 19, 2006
um i'm getting NaN when molInput.text = 0.0391 and titrationInput.text = 0.01630
Inspiring
December 19, 2006
isn't iodine being defined twice there?

shouldn't it be something like

kglad
Community Expert
Community Expert
November 29, 2006
you're welcome.
Inspiring
December 19, 2006
sorry to bring this one up again, but my client is now wanting this code to end up with no decimal point, ie if the answer was 446.5, then they'd want the answer as 447, and i'm a bit frazzled as to what to do, here is my code at the moment...

Inspiring
November 29, 2006
you are a living legend kglad and you get my favourite person of the day :D

thanks a million!!!

my knowledge is slowly building, and a lot of it is due to this forum, thx all!
Inspiring
November 29, 2006
thanks kglad that's the ticket!

it's all now making a little more sense, although i've still got to get my head around some of the code (but big thanks to all who helped out)

my latest file is now http://home.exetel.com.au/twistedpancreas/images/test9.fla

got one small additional question (and maybe it should be a new topic), but is there anyway for the first check button to check for all numbers within the random range of numbers and return them as the correct answer if typed into titration.text (ie titrationValue = any result within the range of 0.02050 to 0.02080)?

i hope that makes sense
kglad
Community Expert
Community Expert
November 29, 2006
you're welcome.

you can check:

kglad
Community Expert
Community Expert
November 29, 2006
try:

www.gladstien.com/new/test.fla
Inspiring
November 29, 2006
actually i've updated my file to resemble how the setup will work

see http://home.exetel.com.au/twistedpancreas/images/test8.fla

i now have input3 as iodine and it's now giving me an answer but i think it's stuck on trying to round the number down to 3 significant figures (ie 0.0210), thus the answer will always be incorrect at the moment

any help would be most appreciated
Inspiring
November 29, 2006
yeah sorry i was going to do that but our network here was mucking up

ok here it is http://home.exetel.com.au/twistedpancreas/images/test7.fla
kglad
Community Expert
Community Expert
November 29, 2006
post a link to your fla.
Inspiring
November 28, 2006
ooops input3 should be as:

this.input3 = roundToDecimalPlace((Number(input1.text)/Number(divisNum))/Number(input2.text),4);
trace(input3)

does that automatically make it a string?

because i tried

convertToNumber = Number(input3);
trace(convertToNumber)

i also tried

(typeof(input3));

(typeof(convertToNumber));

and was still getting NAN, or does (typeof(input3)) not appear in the Output window?

also, now, when you click the calculate button the answer is Correct no matter what the answer.