Skip to content

Commit

Permalink
v0.010 Fri Jul 08 16:50:00 PDT 2016
Browse files Browse the repository at this point in the history
    - Initial release
  • Loading branch information
pryrt committed Jul 8, 2016
1 parent c5a5af4 commit 31522d7
Show file tree
Hide file tree
Showing 12 changed files with 75 additions and 135 deletions.
48 changes: 4 additions & 44 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,47 +1,7 @@
Revision history for Perl module Data::IEEE754::Tools.

TODO: v0.010 initial release?
v0.010 Fri Jul 08 16:50:00 PDT 2016
- Initial release

v0.008 Thu Jul 07
- Start simplification of expand_ieee754() to to_hex/dec_floatingpoint(),
using BrowserUK's suggestion that simpler is better. They utilize the
more standard "-0x1.0123456789abcp+0000" notation
- remove expand_ieee754
- rename val_toggle_ulp to toggle_ulp
- update test suite / names
- add nextup(), nextdown(), nextafter(), and tests
- bug fix ulp/next*.t: include IND in the list of NAN|INF|IND
to ensure that on systems that distinguish -1.#IND from -1.#NAN,
it will still use the text-eq instead of numeric-==.
- bug fix nextafter.t: for nextafter(*NAN, +NAN), need to expect
the value (*NAN), not the direction (+NAN).
- bug fix to_xxx_floatingpoint(-1.#IND) and associated floatingpoint.t:
comparing against wrong $mant for -1.#IND, and wrongly expecting -1.#QNAN

v0.007 Thu Jun 30
- Add ulp() and val_toggle_ulp() functions
- Experimented with value_plus/minus_ulp(), but deleted after major bug,
and discovered Data::Float, which has working versions of

v0.006 Wed Jun 29
- Full POD; good estimated test coverage

v0.005 Tue Jun 28
- Rework options processing
- Improve POD
- Improve test coverage
- Fix bugs found during test coverage debug

v0.004 Tue Jun 21
- Rename to Data::IEEE754::Tools.pm

v0.003 Tue Jun 21
- First "reasonably functional" version

v0.002 Sat Jun 18
- Convert to Data::IEEE754::Expand.pm
- Add initial error handling

v0.001 Thu May 26
Private (pryrt)
- Initial DataFormatIeee.pl proof-of-concept
v0.001 - v0.008
- Private development
Binary file added Data-IEEE754-Tools-v0.010.tar.gz
Binary file not shown.
18 changes: 18 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
AUTHOR

Peter C. Jones <petercj AT cpan DOT org>

Please report any bugs or feature requests emailing <bug-Data-IEEE754-Tools AT rt.cpan.org>
or thru the web interface at <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Data-IEEE754-Tools>

COPYRIGHT

Copyright (C) 2016 Peter C. Jones

LICENCE

This program is free software; you can redistribute it and/or modify it
under the terms of either: the GNU General Public License as published
by the Free Software Foundation; or the Artistic License.

See <http://dev.perl.org/licenses/> for more information.
12 changes: 12 additions & 0 deletions MANIFEST
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
CHANGES
LICENSE
Makefile.PL
MANIFEST This list of files
README
t/00-load.t
t/01-raw754.t
t/02-floatingpoint.t
t/03-ulp.t
t/04-nextupdown.t
t/05-nextafter.t
Tools.pm
17 changes: 5 additions & 12 deletions Makefile.PL
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,21 @@ use 5.008005;
'PREREQ_PM' => {
'Exporter' => 0,
'version' => 0.77,
'warnings' => 0,
'strict' => 0,
'Carp' => 0,
},
);

{
no warnings;
if( $ExtUtils::MakeMaker::VERSION > '6.17' ) {
if( $ExtUtils::MakeMaker::VERSION >= '6.46' ) {
$mm_args{META_MERGE} = {
resources => {
bugtracker => 'http://rt.cpan.org/Public/Dist/Display.html?Name=Data-IEEE754-Tools',
repository => 'https://github.com/pryrt/Data-IEEE754-Tools',
},
keywords => [ 'IEEE-754', 'floating point representation', 'fraction' ],
provides => {
'Data::IEEE754::Tools' => {
file => 'Tools.pm',
version => 0.04,
},
},
keywords => [ 'IEEE-754', 'floating point representation'],
},
}
if( $ExtUtils::MakeMaker::VERSION >= '6.31' ) {
Expand All @@ -41,10 +38,6 @@ use 5.008005;
'ExtUtils::MakeMaker' => 0,
},
}
# if( $ExtUtils::MakeMaker::VERSION >= '6.5503' ) {
# $mm_args{BUILD_REQUIRES} = {
# },
# }
if( $ExtUtils::MakeMaker::VERSION >= '6.64' ) {
$mm_args{TEST_REQUIRES} = {
'warnings' => 0,
Expand Down
51 changes: 22 additions & 29 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -4,42 +4,35 @@ Data::IEEE754::Tools - Various tools for understanding and manipulating the unde

DESCRIPTION

It appears that L<Data::Float> includes most of the functionality, but using IEEE 754
standard function names... That may be a better choice, unless you've got a need
for one of these specific implementations.
These tools give access to the underlying IEEE 754 floating-point
representation used by Perl (see perlguts). They include functions for
converting from the 64bit internal representation to a string that shows
those bits (either as hexadecimal or binary) and back, functions for
converting that encoded value into a more human-readable format to give
insight into the meaning of the encoded values, and functions to
manipulate the smallest possible change for a given floating-point value
(which is the ULP <https://en.wikipedia.org/wiki/Unit_in_the_last_place>
or "Unit in the Last Place").

The L<IEEE754|https://en.wikipedia.org/wiki/IEEE_floating_point> standard describes
various floating-point encodings. The double format (`binary64') is a 64-bit base-2
encoding, and correpsonds to the usual Perl floating value (NV). The format includes the
sign (s), the power of 2 (q), and a coefficient (c): C<value = ((-1)**s) * (c) * (2**q)>.
The C<(-1)**s> term evaluates to the SIGN of the number, where s=0 means the sign
is +1 and s=1 means the sign is -1.
The coefficient is internally encoded as an implied 1 plus an encoded FRACTION,
which is itself encoded as a 52-bit integer divided by an implied 2**52.

L<Data::IEEE754>, or the equivalent L<perlfunc/pack> recipe L<dE<gt>>, do a
good job of converting a perl floating value (NV) into the big-endian bytes
that encode that value, but they don't help you interpret the value.
INSTALLATION

This B<Data::IEEE754::Tools> module takes it to the next step, and provideds
the tools to expand the encoded floating point value into its component sign,
fraction, and exponent, so you can see how it is encoded internally.
To install this module, use your favorite CPAN client.

There are also functions available to let you know what the
L<ULP|https://en.wikipedia.org/wiki/Unit_in_the_last_place> ("Unit in the Last Place")
is for a given value, and another that returns the original value, but modified
by just one ULP (toggle the ULP bit).
For a manual install, type the following:

perl Makefile.PL
make
make test
make install

INSTALLATION
(On Windows machines, you may need to use "dmake" instead of "make".)

To install this module type the following:
AUTHOR

perl Makefile.PL
make
make test
make install
Peter C. Jones <petercj AT cpan DOT org>

Please report any bugs or feature requests emailing <bug-Data-IEEE754-Tools AT rt.cpan.org>
or thru the web interface at <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Data-IEEE754-Tools>

COPYRIGHT

Expand All @@ -51,4 +44,4 @@ This program is free software; you can redistribute it and/or modify it
under the terms of either: the GNU General Public License as published
by the Free Software Foundation; or the Artistic License.

See L<http://dev.perl.org/licenses/> for more information.
See <http://dev.perl.org/licenses/> for more information.
24 changes: 14 additions & 10 deletions Tools.pm
Original file line number Diff line number Diff line change
Expand Up @@ -78,23 +78,14 @@ appropriate.
=cut

########################################################################
# Subversion Info
# $Author: pryrtmx $
# $Date: 2016-07-07 06:57:25 -0700 (Thu, 07 Jul 2016) $
# $Revision: 216 $
# $URL: https://subversion.assembla.com/svn/pryrt/trunk/perl/Data-IEEE754-Tools/Tools.pm $
# $Header: https://subversion.assembla.com/svn/pryrt/trunk/perl/Data-IEEE754-Tools/Tools.pm 216 2016-07-07 13:57:25Z pryrtmx $
# $Id: Tools.pm 216 2016-07-07 13:57:25Z pryrtmx $
########################################################################
package Data::IEEE754::Tools;
use 5.008005;
use warnings;
use strict;
use Carp;
use Exporter 'import'; # just use the import() function, without the rest of the overhead of ISA

use version 0.77; our $VERSION = version->declare('v0.008');
use version 0.77; our $VERSION = version->declare('v0.010');

=head1 EXPORTABLE FUNCTIONS AND VARIABLES
Expand Down Expand Up @@ -466,6 +457,19 @@ sub nextafter {
Include all of the above.
=head1 INSTALLATION
To install this module, use your favorite CPAN client.
For a manual install, type the following:
perl Makefile.PL
make
make test
make install
(On Windows machines, you may need to use "dmake" instead of "make".)
=head1 SEE ALSO
=over
Expand Down
8 changes: 0 additions & 8 deletions t/01-raw754.t
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,6 @@
# hexstr754_to_double()
# binstr754_to_double()
########################################################################
# Subversion Info
# $Author: pryrtmx $
# $Date: 2016-07-06 09:15:17 -0700 (Wed, 06 Jul 2016) $
# $Revision: 210 $
# $URL: https://subversion.assembla.com/svn/pryrt/trunk/perl/Data-IEEE754-Tools/t/01-raw754.t $
# $Header: https://subversion.assembla.com/svn/pryrt/trunk/perl/Data-IEEE754-Tools/t/01-raw754.t 210 2016-07-06 16:15:17Z pryrtmx $
# $Id: 01-raw754.t 210 2016-07-06 16:15:17Z pryrtmx $
########################################################################
use 5.008005;
use warnings;
use strict;
Expand Down
8 changes: 0 additions & 8 deletions t/02-floatingpoint.t
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,6 @@
# to_hex_floatingpoint(v)
# to_dec_floatingpoint(v)
########################################################################
# Subversion Info
# $Author: pryrtmx $
# $Date: 2016-07-07 13:37:19 -0700 (Thu, 07 Jul 2016) $
# $Revision: 222 $
# $URL: https://subversion.assembla.com/svn/pryrt/trunk/perl/Data-IEEE754-Tools/t/02-floatingpoint.t $
# $Header: https://subversion.assembla.com/svn/pryrt/trunk/perl/Data-IEEE754-Tools/t/02-floatingpoint.t 222 2016-07-07 20:37:19Z pryrtmx $
# $Id: 02-floatingpoint.t 222 2016-07-07 20:37:19Z pryrtmx $
########################################################################
use 5.008005;
use warnings;
use strict;
Expand Down
8 changes: 0 additions & 8 deletions t/03-ulp.t
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,6 @@
# toggle_ulp(v)
# remaining :ulp features in next test(s)
########################################################################
# Subversion Info
# $Author: pryrtmx $
# $Date: 2016-07-07 13:37:19 -0700 (Thu, 07 Jul 2016) $
# $Revision: 222 $
# $URL: https://subversion.assembla.com/svn/pryrt/trunk/perl/Data-IEEE754-Tools/t/03-ulp.t $
# $Header: https://subversion.assembla.com/svn/pryrt/trunk/perl/Data-IEEE754-Tools/t/03-ulp.t 222 2016-07-07 20:37:19Z pryrtmx $
# $Id: 03-ulp.t 222 2016-07-07 20:37:19Z pryrtmx $
########################################################################
use 5.008005;
use warnings;
use strict;
Expand Down
8 changes: 0 additions & 8 deletions t/04-nextupdown.t
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,6 @@
# nextdown(v)
# (other :ulp tests in other .t files)
########################################################################
# Subversion Info
# $Author: pryrtmx $
# $Date: 2016-07-07 13:37:19 -0700 (Thu, 07 Jul 2016) $
# $Revision: 222 $
# $URL: https://subversion.assembla.com/svn/pryrt/trunk/perl/Data-IEEE754-Tools/t/04-nextupdown.t $
# $Header: https://subversion.assembla.com/svn/pryrt/trunk/perl/Data-IEEE754-Tools/t/04-nextupdown.t 222 2016-07-07 20:37:19Z pryrtmx $
# $Id: 04-nextupdown.t 222 2016-07-07 20:37:19Z pryrtmx $
########################################################################
use 5.008005;
use warnings;
use strict;
Expand Down
8 changes: 0 additions & 8 deletions t/05-nextafter.t
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,6 @@
# nextafter(v, dir)
# (other :ulp coverage in other .t files)
########################################################################
# Subversion Info
# $Author: pryrtmx $
# $Date: 2016-07-07 13:37:19 -0700 (Thu, 07 Jul 2016) $
# $Revision: 222 $
# $URL: https://subversion.assembla.com/svn/pryrt/trunk/perl/Data-IEEE754-Tools/t/05-nextafter.t $
# $Header: https://subversion.assembla.com/svn/pryrt/trunk/perl/Data-IEEE754-Tools/t/05-nextafter.t 222 2016-07-07 20:37:19Z pryrtmx $
# $Id: 05-nextafter.t 222 2016-07-07 20:37:19Z pryrtmx $
########################################################################
use 5.008005;
use warnings;
use strict;
Expand Down

0 comments on commit 31522d7

Please sign in to comment.