{"id":20575948,"url":"https://github.com/pryrt/data-ieee754-tools","last_synced_at":"2026-04-25T05:39:03.754Z","repository":{"id":56833354,"uuid":"61451317","full_name":"pryrt/Data-IEEE754-Tools","owner":"pryrt","description":"perl module for converting the internal IEEE-754 floating point values into a human-readable interpretation of the underlying data","archived":false,"fork":false,"pushed_at":"2018-06-18T13:23:45.000Z","size":339,"stargazers_count":1,"open_issues_count":3,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-16T21:51:48.018Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pryrt.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-06-18T20:29:49.000Z","updated_at":"2023-10-06T01:23:35.000Z","dependencies_parsed_at":"2022-09-08T07:50:34.686Z","dependency_job_id":null,"html_url":"https://github.com/pryrt/Data-IEEE754-Tools","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pryrt%2FData-IEEE754-Tools","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pryrt%2FData-IEEE754-Tools/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pryrt%2FData-IEEE754-Tools/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pryrt%2FData-IEEE754-Tools/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pryrt","download_url":"https://codeload.github.com/pryrt/Data-IEEE754-Tools/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242196313,"owners_count":20087765,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-16T05:44:10.111Z","updated_at":"2026-04-25T05:39:03.682Z","avatar_url":"https://github.com/pryrt.png","language":"Perl","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NAME\r\n\r\nData::IEEE754::Tools - Various tools for understanding and manipulating the underlying IEEE-754 representation of floating point values\r\n\r\n# SYNOPSIS\r\n\r\n    use Data::IEEE754::Tools qw/:convertToString :ulp/;\r\n\r\n    # return -12.875 as strings of decimal or hexadecimal floating point numbers (\"convertTo*Character\" in IEEE-754 parlance)\r\n    convertToDecimalString(-12.875);        # -0d1.6093750000000000p+0003\r\n    convertToHexString(-12.875);            # -0x1.9c00000000000p+0003\r\n\r\n    # shows the smallest value you can add or subtract to 16.16 (ulp = \"Unit in the Last Place\")\r\n    print ulp( 16.16 );                     # 3.5527136788005e-015\r\n\r\n    # toggles the ulp: returns a float that has the ULP of 16.16 toggled\r\n    #   (if it was a 1, it will be 0, and vice versa);\r\n    #   running it twice should give the original value\r\n    print $t16 = toggle_ulp( 16.16 );       # 16.159999999999997\r\n    print $v16 = toggle_ulp( $t16 );        # 16.160000000000000\r\n\r\n# DESCRIPTION\r\n\r\nThese tools give access to the underlying IEEE 754 floating-point 64bit representation\r\nused by many instances of Perl (see [perlguts](https://metacpan.org/pod/perlguts)).  They include functions for converting\r\nfrom the 64bit internal representation to a string that shows those bits (either as\r\nhexadecimal or binary) and back, functions for converting that encoded value\r\ninto a more human-readable format to give insight into the meaning of the encoded\r\nvalues, and functions to manipulate the smallest possible change for a given\r\nfloating-point value (which is the [ULP](https://en.wikipedia.org/wiki/Unit_in_the_last_place) or\r\n\"Unit in the Last Place\").\r\n\r\n## Justification for the existence of **Data::IEEE754::Tools**\r\n\r\n[Data::IEEE754](https://metacpan.org/pod/Data::IEEE754), or the equivalent [\"pack\" in perlfunc](https://metacpan.org/pod/perlfunc#pack) recipe [d\u003e](https://metacpan.org/pod/d\u003e), do a\r\ngood job of converting a perl floating value (NV) into the big-endian bytes\r\nthat encode that value, but they don't help you interpret the value.\r\n\r\n[Data::Float](https://metacpan.org/pod/Data::Float) has a similar suite of tools to **Data::IEEE754::Tools**, but\r\nuses numerical methods rather than accessing the underlying bits.  It [has been\r\nshown](http://perlmonks.org/?node_id=1167146) that its interpretation function can take\r\nan order of magnitude longer than a routine that manipulates the underlying bits\r\nto gather the information.\r\n\r\nThis **Data::IEEE754::Tools** module combines the two sets of functions, giving\r\naccess to the raw IEEE 754 encoding, or a stringification of the encoding which\r\ninterprets the encoding as a sign and a coefficient and a power of 2, or access to\r\nthe ULP and ULP-manipulating features, all using direct bit manipulation when\r\nappropriate.\r\n\r\n## Compatibility\r\n\r\n**Data::IEEE754::Tools** works with 64bit floating-point representations.\r\n\r\nIf you have a Perl setup which uses a larger representation (for example,\r\n`use [Config](https://metacpan.org/pod/Config); print $Config{nvsize}; # 16 =\u003e 128bit`), values reported by\r\nthis module will be reduced in precision to fit the 64bit representation.\r\n\r\nIf you have a Perl setup which uses a smaller representation (for example,\r\n`use [Config](https://metacpan.org/pod/Config); print $Config{nvsize}; # 4 =\u003e 32bit`), the installation\r\nwill likely fail, because the unit tests were not set up for lower precision\r\ninputs.  However, forcing the installation _might_ still allow coercion\r\nfrom the smaller Perl NV into a true IEEE 754 double (64bit) floating-point,\r\nbut there is no guarantee it will work.\r\n\r\n# INSTALLATION\r\n\r\nTo install this module, use your favorite CPAN client.\r\n\r\nFor a manual install, type the following:\r\n\r\n    perl Makefile.PL\r\n    make\r\n    make test\r\n    make install\r\n\r\n(On Windows machines, you may need to use \"dmake\" or \"gmake\" instead of \"make\", depending on your setup.)\r\n\r\n# AUTHOR\r\n\r\nPeter C. Jones `\u003cpetercj AT cpan DOT org\u003e`\r\n\r\nPlease report any bugs or feature requests emailing `\u003cbug-Data-IEEE754-Tools AT rt.cpan.org\u003e`\r\nor thru the web interface at [http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Data-IEEE754-Tools](http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Data-IEEE754-Tools),\r\nor thru the repository's interface at [https://github.com/pryrt/Data-IEEE754-Tools/issues](https://github.com/pryrt/Data-IEEE754-Tools/issues).\r\n\r\n\u003cdiv\u003e\r\n    \u003ca href=\"https://metacpan.org/pod/Data::IEEE754::Tools\u003e\u003cimg src=\"https://img.shields.io/cpan/v/Data-IEEE754-Tools.svg?colorB=00CC00\" alt=\"\" title=\"metacpan\"\u003e\u003c/a\u003e\r\n    \u003ca href=\"http://matrix.cpantesters.org/?dist=Data-IEEE754-Tools\"\u003e\u003cimg src=\"http://cpants.cpanauthors.org/dist/Data-IEEE754-Tools.png\" alt=\"\" title=\"cpan testers\"\u003e\u003c/a\u003e\r\n    \u003ca href=\"https://github.com/pryrt/Data-IEEE754-Tools/releases\"\u003e\u003cimg src=\"https://img.shields.io/github/release/pryrt/Data-IEEE754-Tools.svg\" alt=\"\" title=\"github release\"\u003e\u003c/a\u003e\r\n    \u003ca href=\"https://github.com/pryrt/Data-IEEE754-Tools/issues\"\u003e\u003cimg src=\"https://img.shields.io/github/issues/pryrt/Data-IEEE754-Tools.svg\" alt=\"\" title=\"issues\"\u003e\u003c/a\u003e\r\n    \u003ca href=\"https://ci.appveyor.com/project/pryrt/data-ieee754-tools\"\u003e\u003cimg src=\"https://ci.appveyor.com/api/projects/status/a9yylnhnufr2g9ug?svg=true\" alt=\"\" title=\"appveyor build status\"\u003e\u003c/a\u003e\r\n    \u003ca href=\"https://travis-ci.org/pryrt/Data-IEEE754-Tools\"\u003e\u003cimg src=\"https://travis-ci.org/pryrt/Data-IEEE754-Tools.svg?branch=master\" alt=\"\" title=\"travis build status\"\u003e\u003c/a\u003e\r\n    \u003ca href=\"https://coveralls.io/github/pryrt/Data-IEEE754-Tools?branch=master\"\u003e\u003cimg src=\"https://coveralls.io/repos/github/pryrt/Data-IEEE754-Tools/badge.svg?branch=master\" alt=\"\" title=\"coveralls test coverage\"\u003e\u003c/a\u003e\r\n\u003c/div\u003e\r\n\r\n# COPYRIGHT\r\n\r\nCopyright (C) 2016-2018 Peter C. Jones\r\n\r\n# LICENSE\r\n\r\nThis program is free software; you can redistribute it and/or modify it\r\nunder the terms of either: the GNU General Public License as published\r\nby the Free Software Foundation; or the Artistic License.\r\n\r\nSee [http://dev.perl.org/licenses/](http://dev.perl.org/licenses/) for more information.\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpryrt%2Fdata-ieee754-tools","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpryrt%2Fdata-ieee754-tools","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpryrt%2Fdata-ieee754-tools/lists"}