Raised This Month: $ Target: $400
 0% 

[fixed]devide float by float AMXX problems


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Owyn
Veteran Member
Join Date: Nov 2007
Old 04-03-2011 , 06:25   [fixed]devide float by float AMXX problems
Reply With Quote #1

PHP Code:
new Devident 16
new Devisor 24
new Float:result floatdivfloat(Devident), float(Devisor) ) 
first it was just
PHP Code:
float(Devident) / float(Devisor
but then i thought that floatdiv() might help, but it does calculations exactly the same way.

it devides 16 by 24 and gets 0.761904 while windows calc.exe gets 0,695652

Devident | Devisor |what amxx gets | what calc.exe gets:

17 by 23 = ( 0.809523 ) against 0,73913043478260869565217391304348
11 by 18 = ( 0.647058 ) against 0,61111111111111111111111111111111
11 by 15 = ( 0.785714 ) against 0,73333333333333333333333333333333
11 by 20 = ( 0.578947 ) against 0,55
9 by 16 = ( 0.600000 ) against 0,5625

what and where is wrong and how it can be fixed?
__________________
☜ Free Mozy ☂backup\҉sync user
Quote:
Американский форум - Задаёшь вопрос, потом тебе отвечают.
Израильский форум - Задаёшь вопрос, потом тебе задают вопрос.
Русский форум - Задаёшь вопрос, потом тебе долго рассказывают, какой ты мудак.
Owyn is offline
Send a message via ICQ to Owyn
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 04-03-2011 , 10:15   Re: devide float by float AMXX problems
Reply With Quote #2

Code:
new Float:result = float(Devident / Devisor)
?
__________________
hleV is offline
Owyn
Veteran Member
Join Date: Nov 2007
Old 04-03-2011 , 12:14   Re: devide float by float AMXX problems
Reply With Quote #3

Quote:
Originally Posted by hleV View Post
Code:
new Float:result = float(Devident / Devisor)

?
won't it be just an integer as division result made into float without anything after dot?

edit: tested, yes it just gives 0.000000 as i wrote above
__________________
☜ Free Mozy ☂backup\҉sync user
Quote:
Американский форум - Задаёшь вопрос, потом тебе отвечают.
Израильский форум - Задаёшь вопрос, потом тебе задают вопрос.
Русский форум - Задаёшь вопрос, потом тебе долго рассказывают, какой ты мудак.

Last edited by Owyn; 04-03-2011 at 12:57.
Owyn is offline
Send a message via ICQ to Owyn
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 04-03-2011 , 13:05   Re: devide float by float AMXX problems
Reply With Quote #4

Have you tried to print result for float(16) and float(24) ?


17.000000 / 23.000000 = 0.739130
ConnorMcLeod : /div 17
PHP Code:
float(str_to_num(szArg2))/float(str_to_num(szArg3)) 
Works fine for me...
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 04-03-2011 at 13:13.
ConnorMcLeod is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 14:32.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode