[Date Prev][Date Next][Thread Prev][Thread Next] - [Date Index][Thread Index][Author Index]

RE: Anybody good at rounding numbers in PERL ?



Thanks to all

I used Math::Round

DATE: 24/08/05 21:05:57
NOVA: ISS AZ:069.3 EL:-66.7 RR:+1.5498138362 AH:N
FREQ: 437975000
DOPP: -2264.16541442712 kHz
D700: FQ 00437970000,0
TUNE: 437.970 MHz

-----Original Message-----
From: Jim Tittsler [mailto:7J1AJH@OnJapan.net]
Sent: Wednesday, 24 August 2005 8:44 PM
To: Andrew Rich
Subject: Re: [amsat-bb] Anybody good at rounding numbers in PERL ?


On 2005/08/24 17:17, Andrew Rich wrote:
> FQ 00437979
> FQ 00437979
>
> Now the d700 wants rounded to nearest 5 kHz.

I don't know what Perl code you are using.

You can:
  - double the number, add 5, replace the last digit with 0, and divide by 2
  - have a lookup table indexed by the last digit that returns the new
last digit, and +00 or +10

Which of those two is easiest will depend upon how you are already
manipulating the number.

Jim

--
Jim Tittsler  7J1AJH/AI8A  Tokyo                     GPG: 0x01159DB6
http://www.qsl.net/7j1ajh/                       QRP/Satellites/APRS
EchoLink:  *TIARA* Conference                            AMSAT/NZART
----
Sent via amsat-bb@amsat.org. Opinions expressed are those of the author.
Not an AMSAT member? Join now to support the amateur satellite program!
To unsubscribe, send "unsubscribe amsat-bb" to Majordomo@amsat.org



AMSAT Top AMSAT Home