From Second Life Wiki
Jump to: navigation, search


This approach of encoding floats is fine for LSO but won't work for Mono. With Mono we will be using doubles and not floats. The underlying principals that iuf and fui depend upon will be invalid and the code will return wrong results. Writing LSO and Mono safe fui functions has turned out to be trickier then I thought. With Mono it won't be possible to store a double in an integer without truncating it to a float first; doing this goes against the design goal of BTLT which is to not corrupt or degrade the input. If I write a version of BTLT targeted for Mono (R3) then it will not be compatible with R2; further more it will not be a simple inline of fui but a new function. Looking to the future HexFloats are looking very attractive. -- Strife Onizuka 00:55, 5 November 2007 (PST)

Most of BTLT is Mono Unsafe code regardless (it means that if the source is compiled from LSL to CIL instead of LSO to CIL it will return wrong results). -- Strife Onizuka 01:05, 5 November 2007 (PST)

There would be a loss in precision by truncating the doubles to floats, and I agree that that is against the concept of BTLT, but I also think that this loss isn't so bad. So long as anyone who uses this library knows that it maxes out as a float, then there is no harm. I like doubles, but most of the time that level of precision is not needed. Hehe, most builders only use 3 decimal places... I chose this library because I was worried about the memory usage of the list of BTLT'd lists I am storing my data in, HexFloats take up a lot more space. I sure hope that they allow true arrays (as in the C/C++/D/Java concept, not the BASIC multidimensional arrays,) when we go to the Mono CIL... Cron Stardust 23:23, 5 November 2007 (PST)

Good news, Mono doesn't use doubles. I will be releasing a new version shortly (I'm just putting the finishing touches on it). It will be faster and better support mono. I have some fresh ideas that I want to try, the format won't change but the functions will. -- Strife Onizuka 08:42, 1 February 2008 (PST)