File: hexdouble.m

package info (click to toggle)
vc 1.4.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,552 kB
  • sloc: cpp: 19,220; ansic: 15,669; sh: 453; xml: 186; makefile: 30
file content (11 lines) | stat: -rw-r--r-- 207 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
function r = hexdouble(x)
  if (signbit(x))
    s = "-";
  else
    s = "";
  endif
  x = abs(x);
  e = floor(log2(x));
  m = round((x*2^-e - 1) * 2^52);
  r = sprintf("%s0x1.%013xp%i", s, m, e);
endfunction