flatten( <variable>, <number> )

Description

This 'flattens' the specified floating point variable to a given number of decimal places.

Sometimes a calculation can result in an annoying recursive number, for example '15 / 9' results in 1.66666667. To keep things sane, you can flatten to two decimal places to convert that into 1.66.
Note that this simply chops off the end of the variable, no rounding is performed.

Notes

One of the biggest causes of failure of if() statements is overzealous accuracy - keep to the degree of accuracy that is necessary, and no more, for 1.2345678 is not 1.234567.

Nothing should happen, but technically "behaviour is undefined" if you request an invalid degree of accuracy (like 20dp), request a higher accuracy then your input (i.e. 1.23 to 5dp), or try to flatten() an integer variable.

Specifics

Under RISC OS, !Teletext runs under the integer maths BBC BASIC V, which offers IEEE-like floating point precision to nine decimal places (the FP version offers true IEEE FP; but we don't require that).
Under Windows, WinTTX actually works to a higher degree of accuracy, however at all points of transferring or storing numerical values, the script interpreter will implicitly round down to nine decimal places.