ieee754 by yt

with text_io,ada.long_long_float_text_io;use text_io;procedure q is
r:long_long_float;d:long_float;s:float;type u is mod 16;h:array(u)of character:="0123456789abcdef";type
a is array(0..19)of u;pragma pack(a);w,x,y,z:a;for
w'address use r'address;for x'address use d'address;for y'address use s'address;l:natural:=19;t,c:character;begin
get(t);while c/=' 'loop get(c);end
loop;ada.long_long_float_text_io.get(r);z:=w;z(0):=z(0)+(-z(1))/15-(2-z(0))/12-(5-z(0))/15;if
t='s'then s:=float(r);l:=7;z:=y;end
if;if t='d'then d:=long_float(r);l:=15;z:=x;end
if;for i in 0..l loop put(h(z(l-i)));end loop;new_line;q;end;

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page