in reply to integer container for float
Cheers,#!perl -l use strict; use warnings; use Config; my $val = 3.625; if($Config{ivsize} == 4) { my $to_int = unpack 'j', pack 'f', $val;; print $to_int; # 1080557568 my $to_float = unpack 'f', pack 'j', $to_int;; print $to_float; # 3.625 } else { print "Can't pack C floats to IV/UV"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: integer container for float
by BrowserUk (Patriarch) on Mar 28, 2016 at 14:08 UTC |