Why not adopt me?
This distribution is up for adoption!
If you're interested then please contact the PAUSE module admins via
email.
NAME
Data::Convert::MicrochipTechnology::Float - Converts Microchip Technology 32-bit float to a number
SYNOPSIS
use Data::Convert::MicrochipTechnology::Float;
my $object = Data::Convert::MicrochipTechnology::Float->new();
my $float=$obj->convert("\0\0\0\0");
print "Float: $float\n";
DESCRIPTION
The format of the PIC 32-bit float is eeeeeeee smmmmmmm mmmmmmmm mmmmmmmm (4-bytes => 8-bit biased exponent, 1-bit sign, 23-bit significand)
The number has value v: v = s * 2**e * m
s = +1 (positive numbers) when the sign bit is 0
s = -1 (negative numbers) when the sign bit is 1
e = Exp - 127 (the exponent is biased with 127)
m = 1.fraction in binary (the significand is the binary number 1 followed by the radix point followed by the binary bits of the fraction). Therefore, 1 = m < 2.
USAGE
CONSTRUCTOR
new
my $object = Data::Convert::MicrochipTechnology::Float->new();
METHODS
convert
my $float=$obj->convert("\0\0\0\0");
my @list=$obj->convert("\0\0\0\0", "\0\0\0\0");
my $listref=$obj->convert("\0\0\0\0", "\0\0\0\0");
my $float=$obj->convert([0,0,0,0]);
my @list=$obj->convert("\0\0\0\0", [0,0,0,0]);
my $listref=$obj->convert("\0\0\0\0", [0,0,0,0]);
float_from_string
my $float=$obj->float_from_string("\0\0\0\0");
float_from_array
my $float=$obj->float_from_array(0, 0, 0, 0);
BUGS
The math introduces floating point rounding errors.
TODO
Add a bit vector capability to eliminate any rounding errors.
SUPPORT
AUTHOR
Michael R. Davis
CPAN ID: MRDVT
DavisNetworks.com
account=>perl,tld=>com,domain=>michaelrdavis
http://www.davisnetworks.com/
COPYRIGHT
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The full text of the license can be found in the LICENSE file included with this module.