develooper Front page | perl.perl5.porters | Postings from July 2014

[perl #122219] support hexadecimal floats

Thread Previous | Thread Next
From:
Jarkko Hietaniemi
Date:
July 3, 2014 02:50
Subject:
[perl #122219] support hexadecimal floats
Message ID:
rt-4.0.18-24326-1404355785-1614.122219-75-0@perl.org
# New Ticket Created by  Jarkko Hietaniemi 
# Please include the string:  [perl #122219]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=122219 >


[resubmitting since I think the grues ate my first attempt]

Perl could support hexadecimal floats:

* literals: 0xh.hhhp[+-]?NNN, e.g. 0x1.47ae147ae147bp-7 is 0.1
* printf %a %A
* input (PV->NV): "0xh.hhhpnnn" + 3

Lack of %a noted by Dan Kogai: https://groups.google.com/d/msg/perl.perl5.porters/c84JU0olnbQ/YwQczyrqE2YJ
Pointer given by Dan: http://en.wikipedia.org/wiki/Printf_format_string#Type

Possibly useful resource: http://www.exploringbinary.com/hexadecimal-floating-point-constants/ found by quick googling.

Ruby does support the %a %A as noted by Dan, and Python has float.hex() and float.fromhex().


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About