In perl, how can I get the actual internal floating point data for a variable? In C, I can do something like this
-
{
-
float f = 5.88;
-
-
unsigned char a[4];
-
-
memcpy(a, (void *)&f, 4)
-
-
printf("0x%x %x %x %x\n", a[3], a[2], a[1], a[0]);
-
}
This prints "0x40 bc 28 f6" -> the IEEE floating point representation for 5.88..
I need to do the same with a statement like
my $f = 5.88;
Thanks,
Doug