AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   [ANY] cannot find sqrt and pow functions! [SOLVED] (https://forums.alliedmods.net/showthread.php?t=261362)

D.Moder 04-10-2015 19:28

[ANY] cannot find sqrt and pow functions! [SOLVED]
 
does sourcepawn have square root and power functions ??
I looked through all include files, I don't see them?!!

Miu 04-10-2015 19:32

Re: [ANY] cannot find sqrt and pow functions!
 
SquareRoot and Pow...? they're in float.inc

D.Moder 04-10-2015 19:37

Re: [ANY] cannot find sqrt and pow functions!
 
oh, ok, so there is no int version of that?


I found
PHP Code:

Float:pow(Float:valueFloat:exponent

so I have to
PHP Code:

RoundToFloor(Pow(float(x),float(y))) 

to get the int version ??

WildCard65 04-10-2015 19:41

Re: [ANY] cannot find sqrt and pow functions!
 
yes

Miu 04-10-2015 19:43

Re: [ANY] cannot find sqrt and pow functions!
 
don't think i've ever even seen a language with int sqrt and pow functions in its standard library

D.Moder 04-10-2015 19:53

Re: [ANY] cannot find sqrt and pow functions!
 
Quote:

Originally Posted by Miu (Post 2284644)
don't think i've ever even seen a language with int sqrt and pow functions in its standard library

in sourcemod we don't have doubles, so this is a different case ok?

and here is what I came up with, in case anyone needed it.
PHP Code:

stock iPow(valueexponent)
{
    return 
RoundToFloor(Pow(float(value), float(exponent)));



Miu 04-10-2015 20:48

Re: [ANY] cannot find sqrt and pow functions!
 
Quote:

Originally Posted by D.Moder (Post 2284648)
in sourcemod we don't have doubles, so this is a different case ok?

:D


All times are GMT -4. The time now is 06:04.

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