Data::Convert::MicrochipTechnology::Float - Converts Microchip Technology 32-bit float to a number
use Data::Convert::MicrochipTechnology::Float; my $object = Data::Convert::MicrochipTechnology::Float->new(); my $float=$obj->convert("\0\0\0\0"); print "Float: $float\n";
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.
my $object = Data::Convert::MicrochipTechnology::Float->new();
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]);
my $float=$obj->float_from_string("\0\0\0\0");
my $float=$obj->float_from_array(0, 0, 0, 0);
The math introduces floating point rounding errors.
Add a bit vector capability to eliminate any rounding errors.
Michael R. Davis CPAN ID: MRDVT DavisNetworks.com account=>perl,tld=>com,domain=>michaelrdavis http://www.davisnetworks.com/
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.
Bit::Vector
To install Data::Convert::MicrochipTechnology::Float, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Data::Convert::MicrochipTechnology::Float
CPAN shell
perl -MCPAN -e shell install Data::Convert::MicrochipTechnology::Float
For more information on module installation, please visit the detailed CPAN module installation guide.