• Hi,

    Trying to use the new inline functions but they seem to be buggy.

    This returns -75.00
    calc(FOVnow,roundval(view.fov,2));
    calc(var.Result,0 - FOVnow);

    This Returns 075.00
    calc(var.Result,0+roundval(view.fov,2));

    This Returns NaN
    calc(var.Result,0 - roundval(view.fov,2));

  • That makes sense. I wouldn't have guessed the result would be a string.
    Very useful function in the end. The amount of times I'm creating a variable just so it can be rounded. Now I can just round it within the calc function. Woohoo.

    I guess I've often wondered if roundval actually speeds anything up. I do it because the original values have 10 or so decimal places so I thought the calculations were creating really long numbers which would slow things down. Maybe the rondval is even slower than just working with the decimals.

  • so I thought the calculations were creating really long numbers which would slow things down.

    No, that doesn't matter at all.
    Internally the computer works with the Numbers in floating-point format.
    A long number is only the result from the conversion to a display-able text.

    Maybe the rondval is even slower than just working with the decimals.

    Yes, when using roundval during calculations it makes them slower. In this case the Number need to be converted to a string with given decimal-points and then for the next calculation again converted back to a Number.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!