This UDF is using in reporting where lots of durations are calculated, stored and then summed up and averaged for reports. By storing the durations as floats (which are similar to the fixed point numbers datetimes are stored as) math functions are simpler.
The problem is that float-times are not human readable, and cast(@floatime as datetime) will produce a date rather than a duration.
This UDF returns "[d days ]hh:mm:ss"
Fast Track to MDX gives readers all the necessary background information needed to write useful, powerful MDX expressions and introduces the most frequently used MDX functions and constructs. No prior knowledge is assumed and examples are used throughout the book to rapidly develop MDX skills to the point where a reader can solve real business problems. A CD containing examples from within the book, and a time-limited version of ProClarity, is included