Don't know how to use floating point values
Hi everyone! I'm a little embarrased for making this question, but I don't know how can I use floating point values in my programs. I know it's possible, by adding .0 or something like that, but this doesn't work for me.
Please, can anyone explain it to me?
I'm trying to get a weight coefficient. I have 3 EditBoxes:
Weight, Height and Coefficient.
Coefficient = Weight/(Height*Height)
When I click on a button, the Coefficient EditBox should show the result, but it always is an integer number.
Thank you.
Re: Don't know how to use floating point values
Coefficient = (Weight*1.0)/(Height*Height)
^^ I think it is like that
Re: Don't know how to use floating point values
Thanks! I'll give it a try and I'll post the results.
Re: Don't know how to use floating point values
Well, I couldn't make it work, but... I tried an easier way. I simply wrote "Val(Get Text)", without adding 0.1, and it worked fine. Now I'm fighting to put it online, but Vitalize won't work with MMF2 programs :-(
Thank you again, my friend.
Re: Don't know how to use floating point values
Make sure you use (val(Edittext$( "Edit Box" ))+0.0) instead of Edit Value( "Edit Box" ).
Re: Don't know how to use floating point values
Hi. This is what I've used:
[color:#3333FF][font:Courier New]Val(Edittext$( "Peso" ))/(Val(Edittext$( "Altura" ))*Val(Edittext$( "Altura" )))[/font][/color]
Without the "+0.0"... Maybe I'm doing something wrong, but it works fine, now.
Re: Don't know how to use floating point values
Always perform a multiplication before a division for the most accurate results :)
Re: Don't know how to use floating point values
Quote:
Originally Posted by raytrace
Always perform a multiplication before a division for the most accurate results :)
[grin] Thanks!