Raised This Month: $ Target: $400
 0% 

maths question


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
freamer
Member
Join Date: Nov 2005
Old 02-28-2007 , 10:57   Re: maths question
Reply With Quote #1

im really stuck now
Code:
public dividef(one)
{
    new Float:var = floatround(float(one) / 100.0)
    server_print("%f / %f / %f", float(one), 100.0, float(var))
    return float(var)
}
in console it has written 33.00000 / 100.00000 / 0.0000
why can this happen?

floatdiv gave the same result

removed floatround and all worked fine

Last edited by freamer; 02-28-2007 at 11:46.
freamer is offline
P34nut
AMX Mod X Beta Tester
Join Date: Feb 2006
Location: Netherlands
Old 02-28-2007 , 12:31   Re: maths question
Reply With Quote #2

Code:
public Float:dividef(Float:fOne, Float:fAnother) {     new Float:var = fOne / fAnother     return var }

if it doesnt work

Code:
public Float:dividef(Float:fOne, Float:fAnother) {     new Float:var = floatdiv(fOne, fAnother)     return var }
__________________
All you need to change the world is one good lie and a river of blood
P34nut is offline
[ --<-@ ] Black Rose
ANNIHILATED
Join Date: Sep 2005
Location: Stockholm, Sweden.
Old 03-03-2007 , 07:31   Re: maths question
Reply With Quote #3

Why create vars?
Code:
public Float:dividef(Float:fOne, Float:fAnother)     return fOne / fAnother
equals
Code:
floatdiv(fOne, fAnother)
equals
Code:
fOne / fAnother
You don't even need a function for that.
[ --<-@ ] Black Rose is offline
Reply



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 00:37.


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