logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Math::PlanePath::Base::Generic -- various path helpers

Description

       This is a few generic helper functions for the PlanePath code.  They're designed to work on plain Perl
       integers and floats and in some cases there's some special support for "Math::BigInt".

Exports

       Nothing is exported by default but each function below can be as in the usual Exporter style,

           use Math::PlanePath::Base::Generic 'round_nearest';

       (But not "parameter_info_nstart0()" and "parameter_info_nstart1()", for the reason described below.)

Functions

Generic
       "$x = round_nearest ($x)"
           Return  $x rounded to the nearest integer.  If $x is half way, such as 2.5 then it's round upwards to
           3.

              $x = round_nearest($x);

       "$href = Math::PlanePath::Base::Generic::parameter_info_nstart0()"
       "$href = Math::PlanePath::Base::Generic::parameter_info_nstart1()"
           Return an "n_start" parameter hashref suitable for use in a  "parameter_info_array()",  with  default
           either 0 or 1.  For example,

               # alone
               package Math::PlanePath::MySubclass;
               use constant parameter_info_array =>
                 [ Math::PlanePath::Base::Generic::parameter_info_nstart1() ];

               # or with other parameters too
               package Math::PlanePath::MySubclass;
               use constant parameter_info_array =>
                 [
                  { name            => 'something',
                    type            => 'integer',
                    default         => '123',
                  },
                  Math::PlanePath::Base::Generic::parameter_info_nstart1(),
                 ];

           This  function is not exportable since it's meant for a one-off call in an initializer and so no need
           to import it for repeated use.

Home Page

License

       Copyright 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021 Kevin Ryde

       This file is part of Math-PlanePath.

       Math-PlanePath is free software; you can redistribute it and/or modify it under  the  terms  of  the  GNU
       General  Public  License  as  published  by  the  Free Software Foundation; either version 3, or (at your
       option) any later version.

       Math-PlanePath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without  even
       the  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
       License for more details.

       You should have received a copy of the GNU General Public License along with Math-PlanePath.  If not, see
       <http://www.gnu.org/licenses/>.

perl v5.32.0                                       2021-01-23                Math::PlanePath::Base::Generic(3pm)

Name

       Math::PlanePath::Base::Generic -- various path helpers

See Also

       Math::PlanePath, Math::PlanePath::Base::Digits, Math::PlanePath::Base::NSEW

Synopsis

        use Math::PlanePath::Base::Generic 'round_nearest';
        $x = round_nearest($x);

See Also