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! :-)
This is a mainly a bug fixing release with several issues and bugs in float numbers handling solved.
In addition to that:
__libc_start_mainC internal initialization function is now correctly handled by Red/System on all supported platforms. This ensures that all libraries relying heavily on C will now work as well as if called from a C program. Thanks to Andreas for the nights spent on digging and debugging that.
By the way, that’s our first birthday (technically ten days ago) since Red project was announced for the first time at the ReBorCon 2011 conference in Amsterdam. The initial schedule has been changed several times since then, to better adapt to the very rapid changes that are occurring in the computing world (massive move to mobile devices to name the main one).
After 900+ commits and thanks to all the contributors, we now have solid foundations to build upon, much better than what I expected to have, one year ago. The focus from now is getting the Red language layer up and running as soon as possible. A large window of opportunities is opening in 2012, so let’s not miss it!