sub double_from_hex { unpack 'd', scalar reverse pack 'H*', $_[0] } use constant POS_INF => double_from_hex '7FF0000000000000'; use constant NEG_INF => double_from_hex 'FFF0000000000000'; use constant qNaN => double_from_hex '7FF8000000000000'; use constant NaN => qNaN; print(POS_INF, "\n"); # 1.#INF print(NEG_INF, "\n"); # -1.#INF print(qNaN, "\n"); # 1.#QNAN