Re: Floating point question

2009-01-14 Thread Chas. Owens
On Wed, Jan 14, 2009 at 14:02, Rob Dixon wrote: > Gunnar Hjalmarsson wrote: >> ANJAN PURKAYASTHA answered: >>> ANJAN PURKAYASTHA asked: I would like to divide a floating point number into its whole and fractional parts. So, ($w, $f)= some_subroutine(12.735) assi

Re: Floating point question

2009-01-14 Thread Rob Dixon
Gunnar Hjalmarsson wrote: > ANJAN PURKAYASTHA answered: >> ANJAN PURKAYASTHA asked: >>> >>> I would like to divide a floating point number into its whole and fractional >>> parts. >>> So, >>> ($w, $f)= some_subroutine(12.735) >>> assigns 12 to $w and 0.735 to $f. >>> >>> Any easy perlish way of doi

Re: Floating point question

2009-01-14 Thread ANJAN PURKAYASTHA
yes modf seems to be the best solution. thanks to all for your feedback! anjan On Tue, Jan 13, 2009 at 7:36 PM, Rob Dixon wrote: > ANJAN PURKAYASTHA wrote: > > Owen wrote: > >> ANJAN PURKAYASTHA wrote: > >>> > >>> I would like to divide a floating point number into its whole and > >>> fractional

Re: Floating point question

2009-01-13 Thread Rob Dixon
ANJAN PURKAYASTHA wrote: > Owen wrote: >> ANJAN PURKAYASTHA wrote: >>> >>> I would like to divide a floating point number into its whole and >>> fractional parts. >>> So, >>> ($w, $f)= some_subroutine(12.735) >>> assigns 12 to $w and 0.735 to $f. >>> >>> Any easy perlish way of doing this? >> >> S

Re: Floating point question

2009-01-13 Thread Gunnar Hjalmarsson
ANJAN PURKAYASTHA answered: ANJAN PURKAYASTHA asked: I would like to divide a floating point number into its whole and fractional parts. So, ($w, $f)= some_subroutine(12.735) assigns 12 to $w and 0.735 to $f. Any easy perlish way of doing this? after some research i was able to answer my own

Re: Floating point question

2009-01-13 Thread ANJAN PURKAYASTHA
thanks owen. after some research i was able to answer my own question. solution: use POSIX; $n= 12.735; $w= floor($n); # assigns the value 12 to $n. $f= $n-$w; # this holds the fractional value. thanks! anjan On Tue, Jan 13, 2009 at 6:13 PM, Owen wrote: > > Hi, > > I would like to divide a f

Re: Floating point question

2009-01-13 Thread Owen
> Hi, > I would like to divide a floating point number into its whole and fractional > parts. > So, > ($w, $f)= some_subroutine(12.735) > assigns 12 to $w and 0.735 to $f. > > Any easy perlish way of doing this? Someone no doubt will have a one liner, but here is a logical way of achieving the re

Floating point question

2009-01-13 Thread ANJAN PURKAYASTHA
Hi, I would like to divide a floating point number into its whole and fractional parts. So, ($w, $f)= some_subroutine(12.735) assigns 12 to $w and 0.735 to $f. Any easy perlish way of doing this? TIA, Anjan -- = anjan purkayastha, phd bioinformatics analyst whitehea