Integer Divide

First things first: there are, at this point, several different scripting languages available for OH. This is both a blessing and a curse for OH. It means that users with different experience or preference can have a scripting language that best suits them, but it also means that help and examples have become very fragmented.

This means, when you are looking around at examples, that you have to be careful that the example you see is using the same language you are. For many of the languages, there are many similarities, so sometimes it can be difficult to tell, even for experienced users.

Along the same lines, it can be very difficult for us to tell which language you want to be using if you don’t specify it in your question and give more context for how you are trying to create these scripts. It’s not 100% clear from your post which language you are trying to use, but based on the two examples that you’ve posted, I’m going to guess that you are trying to use rulesDSL for your script.

This is not surprising in any of the scripting languages. An integer, by definition has no decimal component. So, it doesn’t make sense for it to have a method that controls the number of decimal places. You should really only expect number types that can hold numbers with decimals to have a toFixed method.

In some of the scripting languages, this would work, but not in RulesDSL. You need to specify a source for the parseFloat command, which in this case if the Float class Float::parseFloat. However, that’s not the only problem here. parseFloat is really only intended to find floating point numbers in a string and 299/3 is not a string it’s already a number type so casting it to another number type is likely to be most easily achieved in some other manner.

It looks to me like, in this case, your best chance for getting a clear answer to this particular difficulty (and in general) and learning more about the OH scripting options, is to put far more information into your question (if you go back and look at your original post, it, in fact, doesn’t even include a question so perhaps you are just looking to blow of steam and not actually requesting assistance in the first place?). What language are using, what does the full script look like, what are you attempting to do with the script?