Float problem
Hey, Why do I get round float ?
I've code: PHP Code:
PHP Code:
a / b = 4.0 As the result should be 6436 / 1544 = 4.1 ( 4.168... ) |
Re: Float problem
Your stock needs a float tag and its case sensitive, so it MUST be "Float".
EDIT: this seems to work, returns 4.168393 Code:
Float:get_float_ab() |
Re: Float problem
ok, but it still returns me round number, 4.0 instead of 4.1.
|
Re: Float problem
I dunno what version of my post you saw, read again 'cause it works now. :lol:
|
Re: Float problem
Ok thanks, now it works. one more question but it's not so necessary, How can I round number from 4.16 to 4.2 ?
Round the second number after dot. |
Re: Float problem
If you're only using it for printing, you can just use %.1f and it will round 4.168393 to 4.2.
But for actual stored rounded value, I dunno :/ |
Re: Float problem
There might be an easier way, but for rounding to a number of decimal places, you can always do
PHP Code:
PHP Code:
|
Re: Float problem
PHP Code:
|
Re: Float problem
a and b arent floats
|
Re: Float problem
Code:
|
| All times are GMT -4. The time now is 04:17. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.