By Daniel · January 11, 2009
Returns a hexadecimal string representation of some integer (which should be given as a real, not a string).
/* dec2hex(int)
*
* Returns a hexadecimal string representation of some integer (which
* should be given as a real, not a string).
*/
var lang, neg, hex;
lang = '0123456789ABCDEF';
neg = (argument0 < 0);
if (neg) argument0 *= -1;
hex = '';
while (argument0) {
hex = string_char_at(lang, (argument0 & 15) + 1) + hex;
argument0 = argument0 >> 4;
}
return neg*'-' + hex;
Categories: Data processing, Mathematics
There are no comments to display.
You must be signed in to post comments.