New Red/System version 0.2.4 is out. The main new feature is floating point numbers support. This feature was not planned, but as users were strongly pushing for having it now, we have added partial support for floats. Users can now wrap and use libraries like OpenGL.
Two new IEEE-754 datatypes were added:
They are first-class datatypes, so they can be used anywhere, as variables, arguments or returned values.
Basic math and comparison operations are supported. Transcendental functions are not predefined yet in the runtime, they need to be imported first from an external library. For equality test, no rounding is applied, so only exact float numbers match will return
true. Adding an “almost-equal” operator is planned, but not available yet.
Also, type casting is allowed between:
Remember to type cast all float32! values to float! when passing them as argument to C variadic functions. For non-variadic C functions, Red/System’s compiler will promote float32! to float! automatically.
Not all of IEEE-754 standard was implemented yet. See the remaining features to add in this todo-list.
At low-level, floating point support is architecture-specific:
cpu-version), which triggers the use of older opcodes. For example, in order to use floats on older than PentiumPro CPU, you need to add this line in the target definition:
Several thousands new tests were added to the test suite, pushing the total number of unit tests to 11755. Thanks to Peter for taking care of that.
As IEEE-754 2008 revision introduced several new decimal floating point formats, we plan to support them later in Red/System.
A contributed feature is also part of this new version of Red/System: C-like enumeration support. This contribution was brought by the lead developer of Amanita Design, small independent game developing studio based in Czech Republic, which released the award-winning game Machinarium. A new compilation directive was added to declare enumerations: #enum.
We got noticed by Ruby’s author, Matz, he tweeted about Red! :-)