Thursday, March 1, 2012

NXT Blocks - Conversion Utils - String To Float (GSAString2Float)

In my last post, I presented a way of serializing one or multiple numbers to string GSAFloat2String. As may you already expected, I will provide you today with the counter part or mirror function block GSAString2Float.

This block provide us with the possibility to deserialize a string or a portion of a string (previously serialized by GSAFloat2String or any other means to have the IEEE 754 format contained in the string) to a floating point number.

Inputs:
1. Input String - any string containing IEEE 754 blocks
2. Value Offset - the offset of the IEEE 754 block within the Input String.
3. Default Value - the value provided in case of conversion errors

Outputs:
1. Output value - a single point precision floating number

In case of strings containing multiple numbers we can de-serialize all one by one providing the offset for each number within the string. Remember each value is encoded on 4 bytes (IEEE 754).


You can download  GSAString2Float here.

No comments:

Post a Comment