Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

How to use rad2rad

by Masayoshi Fujimoto (Initiate)
on Jan 26, 2013 at 15:33 UTC ( #1015501=perlquestion: print w/ replies, xml ) Need Help??
Masayoshi Fujimoto has asked for the wisdom of the Perl Monks concerning the following question:

Could you tell me very easy simple example how to use rad2rad function? Here is my perl programme. I got the following message:
Undefined subroutine &main::rad2rad called at line 8.
#!/usr/bin/perl use Modern::Perl; use autodie; use Math::Trig; use Math::Trig ':pi'; my $radians; my $radians_wrapped_by_2pi = rad2rad($radians);

Comment on How to use rad2rad
Select or Download Code
Replies are listed 'Best First'.
Re: How to use rad2rad
by Athanasius (Canon) on Jan 26, 2013 at 15:40 UTC

    Hello Masayoshi Fujimoto, and welcome to the Monastery!

    The function rad2rad is not exported by the Math::Trig module, so to use it you need to put the full module name in front:

    my $radians_wrapped_by_2pi = Math::Trig::rad2rad($radians);

    Update: Here is an example of rad2rad() in use:

    use Modern::Perl; use Math::Trig ':pi'; my $radians = 4.5 * pi; my $radians_wrapped_by_2pi = Math::Trig::rad2rad($radians); say 'rad2rad(', $radians, ') = ', $radians_wrapped_by_2pi;


    1:49 >perl rad2rad(14.1371669411541) = 1.5707963267949 1:49 >

    Hope that helps,

    Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,

      Good example. Thank you very much.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1015501]
Approved by Athanasius
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (2)
As of 2015-11-28 22:11 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (746 votes), past polls