40
loading...
This website collects cookies to deliver better user experience
$N
less than or equal to 255.s/(.)(.)/$2$1/g
), and then convert it back a decimal number. And there is nothing wrong with that approach.&
and shift bit operators <<
and >>
to calculate the value. We take the even values (170 = 2 + 8 + 32 + 128) and shift those one place to the right (the same as dividing by two), and the odd vales ( 85 = 1 + 4 + 16 + 64) and shift them to the left (same as multiplying by 2).$ ./ch-1.pl 101
154
$ ./ch-1.pl 18
33
$T
in the format hh:mm
.360 * $minute / 60
.360 * ( $hour / 12 + $minute / 720 )
$ ./ch-2.pl 03:10
35°
$ ./ch-2.pl 04:00
120°
40