Math::...eneric(3pm)
π Math::PlanePath::Base::Generic β the lil helper bestie of the PlanePath universe π
okay so this is Math::...eneric(3pm) from the User Contributed Perl Documentation, and it's genuinely one of those "small but iconic" modules. let's get into it π«Ά
β¨ NAME β¨
Math::PlanePath::Base::Generic β various path helpers. that's it, that's the whole job description, and she does it flawlessly π
πΈ SYNOPSIS πΈ
use Math::PlanePath::Base::Generic 'round_nearest';
$x = round_nearest($x);
like. that's the vibe. import one thing, round one number, go live your life π¦
π DESCRIPTION π
so basically this is a little grab-bag of generic helper functions for the PlanePath code. they're built to work on plain Perl integers and floats, no drama, no fuss π
and in some cases there's also some special support for "Math::BigInt", because sometimes numbers are big and we respect that π
π§ EXPORTS π§
okay so nothing is exported by default β no sneaky auto-imports, she's polite like that. but every function below can be imported in the usual Exporter style, like so:
use Math::PlanePath::Base::Generic 'round_nearest';
β οΈ but NOTparameter_info_nstart0()andparameter_info_nstart1(), and there's a whole reason for that which we get to below. foreshadowing! π
π FUNCTIONS π
π Generic π
$x = round_nearest ($x)β returns$xrounded to the nearest integer β¨. and if$xis exactly half way, like2.5, then it rounds upwards to3. no banker's rounding nonsense here bestie, we go UP π
$x = round_nearest($x);
$href = Math::PlanePath::Base::Generic::parameter_info_nstart0()$href = Math::PlanePath::Base::Generic::parameter_info_nstart1()β these two return an"n_start"parameter hashref that's suitable for use in a"parameter_info_array()", with a default of either0or1(hence the names, iykyk π).
for example, all alone:
# alone
package Math::PlanePath::MySubclass;
use constant parameter_info_array =>
[ Math::PlanePath::Base::Generic::parameter_info_nstart1() ];
or hanging out with other parameters too:
# 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(),
];
π and here's the tea on why these two aren't exportable: this function is not exportable since it's meant for a one-off call in an initializer β so there's literally no need to import it for repeated use. she's a one-time appearance, main character energy, no recurring role π
π₯ SEE ALSO π₯
Math::PlanePathMath::PlanePath::Base::DigitsMath::PlanePath::Base::NSEW
the whole squad, fr fr π
π HOME PAGE π
<http://user42.tuxfamily.org/math-planepath/index.html>
go say hi, she doesn't bite π¦
π 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/>.
π yes bestie, that's the real license text, ALL CAPS WARRANTY DISCLAIMER and everything. respect the legal bits, they ate π―
aaaand that's the whole page π this was Math::...eneric(3pm), rendered for perl v5.32.0, dated 2021-01-23. tysm for reading, go round some numbers to the nearest integer, mwah πβ¨
π¦ where this page comes from
- debian bookworm: libmath-planepath-perl 129-1 Β· GPL-3.0-or-later
- debian trixie: libmath-planepath-perl 129-1 Β· GPL-3.0-or-later
- ubuntu jammy: libmath-planepath-perl 129-1 Β· GPL-3.0-or-later
- ubuntu noble: libmath-planepath-perl 129-1 Β· GPL-3.0-or-later
- ubuntu resolute: libmath-planepath-perl 129-1 Β· GPL-3.0-or-later
- ubuntu stonking: libmath-planepath-perl 129-1 Β· GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms