do floatmul/div really needed?
#1

I only tested with floatmul
pawn Код:
main()
{
    new Float:x = 23.0, Float:y = 21.0, Float:z = 45.1, Float:x1 = 45.2, Float:y1 = 68.1, Float:z1 = 28.5;
    x1 = x + floatmul(x1, 5); //with floatmul
    y1 = y + floatmul(y1, 5);
    z1 = z + floatmul(z1, 5);
    printf("%f, %f, %f", x1,y1,z1);
   
    new Float:xa = 23.0, Float:ya = 21.0, Float:za = 45.1, Float:xb = 45.2, Float:yb = 68.1, Float:zb = 28.5;
    xb = xa + xb * 5; //without floatmul
    yb = ya + yb * 5;
    zb = za + zb * 5;
    printf("%f, %f, %f", xb,yb,zb);
}
Prints:
249.000000, 361.500000, 187.600006
249.000000, 361.500000, 187.600006

Same results. So are they really needed?
Reply
#2

No, you can use the standard operators. The standard operators are overloaded to call these respective functions. Using the functions might be marginally faster, but they don't improve readability.

In float.inc:
pawn Код:
stock Float:operator*(Float:oper1, oper2)
    return floatmul(oper1, float(oper2));       /* "*" is commutative */
Reply
#3

So... using the functions are just slightly faster than the standard one?
Reply
#4

The use of the functions are to overload the operators, to support floating point operations in PAWN.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)