Advertisement
Guest User

Untitled

a guest
May 25th, 2015
264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. /* -----------------------------------------------------------------------------
  2. Function: CBA_fnc_floatToString
  3.  
  4. Description:
  5. Returns a higher precision string representation of a IEEE 754 floating point
  6. number than the str function. This function is as barebones as possible. Inline
  7. macro version of this function can be used with FLOAT_TO_STRING(num).
  8.  
  9. Limitations:
  10.  
  11.  
  12. Parameters:
  13. _number - Number to format [Number]
  14.  
  15. Returns:
  16. The number formatted into a string.
  17.  
  18. Examples:
  19. (begin example)
  20. _str = 100.12345678 call CBA_fnc_floatToString; // _str = "100.123459", using (str 100.12345678) results in "100.123"
  21. _str = 2000.1236 call CBA_fnc_floatToString; // _str = "2000.1236570", using (str 2000.1236) results in "2000.12"
  22. (end)
  23.  
  24. Author:
  25. Nou
  26. ---------------------------------------------------------------------------- */
  27.  
  28. str floor _this + "." + (str (_this-floor _this) select [2]) + "0";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement