Result:
found more than 670 distributions - search limited to the first 2001 files matching your query ( run in 2.466 )


Geo-Horizon

 view release on metacpan or  search on metacpan

lib/Geo/Horizon.pm  view on Meta::CPAN

  return $self->{'ellipsoid'};
}

=head2 distance

The straight-line of sight distance to the horizon: This formula does not take in account radio or optical refraction which will be further the longer the wavelength.

  my $dist=$obj->distance($alt, $lat);  #alt in meters (ellipsoid units)
                                        #lat in signed decimal degrees
  my $dist=$obj->distance($alt);        #default lat => 0 (equator)
  my $dist=$obj->distance;              #default alt => 1.7

 view all matches for this distribution


Geo-Index

 view release on metacpan or  search on metacpan

lib/Geo/Index.pm  view on Meta::CPAN

  print "$$closest{name}\n";     # Also prints 'South Pole'
  
  ($farthest) = $index->Farthest( [ 90, 0 ] );
  print "$$farthest{name}\n";    # Also prints 'South Pole'
  
  # Compute distance in meters between two points (using haversine formula)
  
  $m = $index->Distance( { lat=>51.507222, lon=>-0.1275 }, [ -6.2, 106.816667 ] );
  printf("London to Jakarta: %i km\n", $m / 1000);
  
  $index->DistanceFrom( [ 90, 0 ] );

lib/Geo/Index.pm  view on Meta::CPAN

circumference assuming a spherical (not an oblate) body.

=item *
B<C<search_result_distance>> - Distance (in meters) of point from search 
point of previous search.  The distance computation assumes a spherical body 
and is computed using a ruggedized version of the haversine formula.  This 
value is only generated when C<L<Search(...)|/Search( ... )>> is called with the C<radius> 
or C<sort_results> option.  See also C<L<Distance(...)|/Distance( ... )>>, C<L<DistanceFrom(...)|/DistanceFrom( ... )>>, 
and C<L<DistanceTo(...)|/DistanceTo( ... )>>.

=item *
B<C<antipode_distance>> - Distance (in meters) of point from search 
point's antipode as determined by a previous call to C<L<Farthest(...)|/Farthest( ... )>>.
This distance is computed using a ruggedized version of the haversine formula.

=back

As a convenience, most methods allow points to be specified using a shorthand 
notation S<C<[ I<lat>, I<lon> ]>> or S<C<[ I<lat>, I<lon>, I<data> ]>>.  Points 

lib/Geo/Index.pm  view on Meta::CPAN




#. Distance functions
#. 
#. Geo::Index uses the haversine formula to compute great circle distances 
#. between points.
#. 
#. Three versions are supported: a fallback version written in Perl (used if the 
#. C versions fail to compile) and two accelerated versions written in C, one 
#. using floats and the other using doubles.  By default the C float version is 

lib/Geo/Index.pm  view on Meta::CPAN

	            ( $sin_lon_diff_over_2 * $sin_lon_diff_over_2 )
	            * $DistanceFrom_cos_lat_1
	            * cos( $lat_0 )
	          );
	
	#. The haversine formula may get messy around antipodal points so clip to the largest sane value.
	if ( $n < 0.0 ) { $n = 0.0; }
	
	return $DistanceFrom_diameter  * asin( sqrt($n) );
}

lib/Geo/Index.pm  view on Meta::CPAN

is not done then the distance values from the first search may be overwritten by 
those of the subsequent searches.

=item *

Geo::Index uses the spherical haversine formula to compute distances.  While 
quite fast, its accuracy over long distances is poor, with a worst case error 
of about 0.1% (22 km).  Since the module already has provision for changing the 
backends used for the distance methods, adding a new backend to, for example, 
compute accurate distances on e.g. a WGS-84 spheroid would be simple and 
straight-forward.

 view all matches for this distribution


Geo-METAR

 view release on metacpan or  search on metacpan

TODO  view on Meta::CPAN

    will fail on.


  * Calculate Heat Index and/or Wind Chill

    Both would be fairly easy to do, provided you get the formulas
    correct. (Those vary around the world!)


If you'd like to submit a patch for any of these, please let me know!
Please put 'METAR' in the subject of your e-mail.

 view all matches for this distribution


Geo-MedianCenter-XS

 view release on metacpan or  search on metacpan

lib/Geo/MedianCenter/XS.pm  view on Meta::CPAN

longitude in decimal degrees.

=item haversine_distance_dec($lat1, $lon1, $lat2, $long2)

Computes the distance between the two points using the Haversine
formula in meters. Latitude and longitude are specified in decimal
degrees.

=item haversine_distance_rad($lat1, $lon1, $lat2, $long2)

Computes the distance between the two points using the Haversine
formula in meters. Latitude and longitude are specified in radians.

=back

=head2 EXPORT

 view all matches for this distribution


Geo-PostalCode-NoDB

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

      longitude are the same.  This only holds true at the equator;
      otherwise the distance between two degrees longitude is:

          cos($lat*PI/180)*LON_MILEAGE_CONSTANT

      This formula is probably well-known, but I got it from:

          http://www.malaysiagis.com/related_technologies/mapping/basics1b.cfm

      This corrected a bug where the cells searched would often miss
      areas that were a ways away from the site.

 view all matches for this distribution


Geo-PostalCode

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

      longitude are the same.  This only holds true at the equator;
      otherwise the distance between two degrees longitude is:

          cos($lat*PI/180)*LON_MILEAGE_CONSTANT

      This formula is probably well-known, but I got it from:

          http://www.malaysiagis.com/related_technologies/mapping/basics1b.cfm

      This corrected a bug where the cells searched would often miss
      areas that were a ways away from the site.

 view all matches for this distribution


Geo-Query

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

Revision history for Perl extension Geo::Query.

0.04	08 Jul 2010

	- Fixed distance formula for southern hemisphere


0.03	Mon Feb 11 07:42:42 CET 2008

	- Calculates distances.

 view all matches for this distribution


Geo-Spline

 view release on metacpan or  search on metacpan

README.md  view on Meta::CPAN

This program was developed to be able to calculate the position between two GPS fixes using a 2-dimensional 3rd order polynomial spline.

    f(t)  = A + B(t-t0)  + C(t-t0)^2 + D(t-t0)^3 #position in X and Y
    f'(t) = B + 2C(t-t0) + 3D(t-t0)^2            #velocity in X and Y

I did some simple Math (for an engineer with a math minor) to come up with these formulas to calculate the unknowns from our knowns.

    A = x0                                     # when (t-t0)=0 in f(t)
    B = v0                                     # when (t-t0)=0 in f'(t)
    C = (x1-A-B(t1-t0)-D(t1-t0)^3)/(t1-t0)^2   # solve for C from f(t)
    C = (v1-B-3D(t1-t0)^2)/2(t1-t0)            # solve for C from f'(t)

 view all matches for this distribution


Geo-WeatherNWS

 view release on metacpan or  search on metacpan

lib/Geo/WeatherNWS.pm  view on Meta::CPAN

  $Report->{windchill_f}        # Wind Chill (degrees f)
  $Report->{windchill_c}        # Wind Chill (degrees c)
  $Report->{heat_index_f}       # Heat Index (degrees f)
  $Report->{heat_index_c}       # Heat Index (degrees c)

  Note: Due to the formulas used to get the heat index and windchill,
  sometimes these values are a little strange.  A check to see if the
  heat index is above the temperature before displaying it would be
  a good thing for you to do.  You probably don't want to display
  the windchill unless its cold either.

 view all matches for this distribution


GeoIP2

 view release on metacpan or  search on metacpan

maxmind-db/MaxMind-DB-spec.md  view on Meta::CPAN

This key is optional. However, creators of databases are strongly
encouraged to include a description in at least one language.

### Calculating the Search Tree Section Size

The formula for calculating the search tree section size *in bytes* is as
follows:

    ( ( $record_size * 2 ) / 8 ) * $number_of_nodes

The end of the search tree marks the beginning of the data section.

maxmind-db/MaxMind-DB-spec.md  view on Meta::CPAN

then it is an actual pointer value pointing into the data section. The value
of the pointer is relative to the start of the data section, *not* the
start of the file.

In order to determine where in the data section we should start looking, we use
the following formula:

    $data_section_offset = ( $record_value - $node_count ) - 16

The 16 is the size of the data section separator. We subtract it because we
want to permit pointing to the first byte of the data section. Recall that

maxmind-db/MaxMind-DB-spec.md  view on Meta::CPAN

is a *node number*, and we look up that node. If a record contains a value
greater than or equal to 1,016, we know that it is a data section value. We
subtract the node count (1,000) and then subtract 16 for the data section
separator, giving us the number 0, the first byte of the data section.

If a record contained the value 6,000, this formula would give us an offset of
4,984 into the data section.

In order to determine where in the file this offset really points to, we also
need to know where the data section starts. This can be calculated by
determining the size of the search tree in bytes and then adding an additional

maxmind-db/MaxMind-DB-spec.md  view on Meta::CPAN


    $offset_in_file = $data_section_offset
                      + $search_tree_size_in_bytes
                      + 16

Since we subtract and then add 16, the final formula to determine the
offset in the file can be simplified to:

    $offset_in_file = ( $record_value - $node_count )
                      + $search_tree_size_in_bytes

 view all matches for this distribution


Geography-NationalGrid-TW

 view release on metacpan or  search on metacpan

lib/Geography/NationalGrid/TW.pm  view on Meta::CPAN


Returns the item from the Userdata hash whose key is the PARAMETER_NAME.

=item transform( PROJECTION )

Transform the point to the new projection, i.e. TWD67 to TWD97 or reverse. Return the point after transformation and keep original point intact. Uses the formula proposed by John Hsieh which is supposed to provide 2 meter accuracy conversions.

=back

=head1 ACCURACY AND PRECISION

 view all matches for this distribution


Geometry-Formula

 view release on metacpan or  search on metacpan

lib/Geometry/Formula.pm  view on Meta::CPAN


sub circle {
    my ( $self, %param, $x ) = @_;
    _param_check( 'circle', %param );

    if ( $param{'formula'} eq 'area' ) {
        $x = $PI * $self->_squared( $param{'radius'} );
    }
    elsif ( $param{'formula'} eq 'circumference' ) {
        $x = ( 2 * $PI ) * $param{'radius'};
    }
    else {
        $x = $param{'radius'} * 2;
    }

lib/Geometry/Formula.pm  view on Meta::CPAN


sub cube {
    my ( $self, %param, $x ) = @_;
    _param_check( 'cube', %param );

    if ( $param{'formula'} eq 'surface_area' ) {
        $x = 6 * ( $param{'a'} * 2 );
    }
    else {
        $x = $self->_cubed( $param{'a'} );
    }

lib/Geometry/Formula.pm  view on Meta::CPAN


sub ellipse {
    my ( $self, %param, $x ) = @_;
    _param_check( 'ellipse', %param );

    if ( $param{'formula'} eq 'area' ) {
        $x = $PI * ( $param{'a'} * $param{'b'} );
    }
    else {
        $x = 2 * $PI *
          sqrt( ( $self->_squared( $param{'a'} ) + $self->_squared( $param{'b'} ) ) / 2 );

lib/Geometry/Formula.pm  view on Meta::CPAN


sub frustum_of_right_circular_cone {
    my ( $self, %param, $x ) = @_;
    _param_check( 'frustum_of_right_circular_cone', %param );

    if ( $param{'formula'} eq 'lateral_surface_area' ) {
        $x =
          $PI *
          ( $param{'large_radius'} + $param{'small_radius'} ) *
          sqrt( $self->_squared( $param{'large_radius'} - $param{'small_radius'} ) +
              $self->_squared( $param{'slant_height'} ) );
    }
    elsif ( $param{'formula'} eq 'total_surface_area' ) {
        my $slant_height =
          sqrt( $self->_squared( $param{'large_radius'} - $param{'small_radius'} ) +
              $self->_squared( $param{'height'} ) );

        $x =

lib/Geometry/Formula.pm  view on Meta::CPAN


sub parallelogram {
    my ( $self, %param, $x ) = @_;
    _param_check( 'parallelogram', %param );

    if ( $param{'formula'} eq 'area' ) {
        $x = $param{'base'} * $param{'height'};
    }
    else {
        $x = ( 2 * $param{'a'} ) + ( 2 * $param{'b'} );
    }

lib/Geometry/Formula.pm  view on Meta::CPAN


sub rectangle {
    my ( $self, %param, $x ) = @_;
    _param_check( 'rectangle', %param );

    if ( $param{'formula'} eq 'area' ) {
        $x = $param{'length'} * $param{'width'};
    }
    else {
        $x = ( 2 * $param{'length'} ) + ( 2 * $param{'width'} );
    }

lib/Geometry/Formula.pm  view on Meta::CPAN


sub rectangular_solid {
    my ( $self, %param, $x ) = @_;
    _param_check( 'rectangular_solid', %param );

    if ( $param{'formula'} eq 'volume' ) {
        $x = $param{'length'} * $param{'width'} * $param{'height'};
    }
    else {
        $x =
          2 *

lib/Geometry/Formula.pm  view on Meta::CPAN


sub right_circular_cone {
    my ( $self, %param, $x ) = @_;
    _param_check( 'right_circular_cone', %param );

    if ( $param{'formula'} eq 'lateral_surface_area' ) {
        $x =
          $PI *
          $param{'radius'} *
          ( sqrt( $self->_squared( $param{'radius'} ) + $self->_squared( $param{'height'} ) ) );
    }

lib/Geometry/Formula.pm  view on Meta::CPAN


sub right_circular_cylinder {
    my ( $self, %param, $x ) = @_;
    _param_check( 'right_circular_cylinder', %param );

    if ( $param{'formula'} eq 'lateral_surface_area' ) {
        $x = 2 * $PI * $param{'radius'} * $param{'height'};
    }
    elsif ( $param{'formula'} eq 'total_surface_area' ) {
        $x =
          2 * $PI * $param{'radius'} * ( $param{'radius'} + $param{'height'} );
    }
    else {
        $x = $PI * ( $self->_squared( $param{'radius'} ) * $param{'height'} );

lib/Geometry/Formula.pm  view on Meta::CPAN


sub sphere {
    my ( $self, %param, $x ) = @_;
    _param_check( 'sphere', %param );

    if ( $param{'formula'} eq 'surface_area' ) {
        $x = 4 * $PI * $self->_squared( $param{'radius'} );
    }
    else {
        $x = ( 4 / 3 ) * $PI * $self->_cubed( $param{'radius'} );
    }

lib/Geometry/Formula.pm  view on Meta::CPAN


sub square {
    my ( $self, %param, $x ) = @_;
    _param_check( 'square', %param );

    if ( $param{'formula'} eq 'area' ) {
        $x = $self->_squared( $param{'side'} );
    }
    else {
        $x = $param{'side'} * 4;
    }

lib/Geometry/Formula.pm  view on Meta::CPAN


sub torus {
    my ( $self, %param, $x ) = @_;
    _param_check( 'torus', %param );

    if ( $param{'formula'} eq 'surface_area' ) {
        $x = 4 * $self->_squared($PI) * $param{'a'} * $param{'b'};
    }
    else {
        $x = 2 * $self->_squared($PI) * $self->_squared( $param{'a'} ) * $param{'b'};
    }

lib/Geometry/Formula.pm  view on Meta::CPAN


sub trapezoid {
    my ( $self, %param, $x ) = @_;
    _param_check( 'trapezoid', %param );

    if ( $param{'formula'} eq 'area' ) {
        $x = ( ( $param{'a'} + $param{'b'} ) / 2 ) * $param{'height'};
    }
    else {
        $x = $param{'a'} + $param{'b'} + $param{'c'} + $param{'d'};
    }

lib/Geometry/Formula.pm  view on Meta::CPAN


sub triangle {
    my ( $self, %param, $x ) = @_;
    _param_check( 'triangle', %param );

    if ( $param{'formula'} eq 'area' ) {
        $x = .5 * $param{'base'} * $param{'height'};
    }
    else {
        $x = $param{'a'} + $param{'b'} + $param{'c'};
    }

lib/Geometry/Formula.pm  view on Meta::CPAN

            perimeter => [ 'a',    'b', 'c' ]
        },
    );

    # validate that parameter values are defined and numeric
    foreach ( @{ $valid_params{$method}{ $param{'formula'} } } ) {
        croak "required parameter '$_' not defined"
          if !$param{$_};

        croak "parameter '$_' requires a numeric value"
          if $param{$_} !~ m/^\d+$/;
    }

    # validate parameter is a valid constructor/component of formula
    foreach my $param ( keys %param ) {
        next if $param eq 'formula';

        my @constructors = @{ $valid_params{$method}{ $param{'formula'} } };

        if ( !@constructors ) {
            croak "invalid formula name: $param{'formula'} specified";
        }

        if ( grep { $_ eq $param } @constructors ) {
            next;
        }

lib/Geometry/Formula.pm  view on Meta::CPAN


=pod

=head1 NAME

Geometry::Formula - methods to calculate common geometry formulas.

=head1 VERSION

    Version 0.01

lib/Geometry/Formula.pm  view on Meta::CPAN

    my $x = Geometry::Formula->new;

=head1 DESCRIPTION

This package provides users with the ability to calculate simple geometric
problems using the most common geometry formulas. This module was primarily
written for education and practical purposes.  

=head1 CONSTRUCTOR

=over

=item C<< new() >>

Returns a reference to a new formula object. No arguments currently needed
or required.

=back

=head1 SUBROUTINES/METHODS

The following methods are used to calculate our geometry formulas. Keep in
mind each formula has a unique set of constructors/parameters that are used
and must be provided accordingly. All attempts have been made to prevent a
user from providing invalid data to the method.

Methods are named after the 2d and 3d shapes one would expect to find while
using geometric formulas such as square or cube. Please see the individual
method items for the specific parameters one must use. In the example below
you can see how we make usage of Geometry::Formula:

    use Geometry::Formula;

    my $x   = Geometry::Formula->new;
    my $sqr = $x->square{ formula => 'area', side => 5 };

    print $sqr;
    ---
    25

=over

=item C<< annulus() >>

The annulus method provides an area formula. 

required: inner_radius, outer_radius

    $x->annulus{
        formula      => 'area',
        inner_radius => int,
        outer_radius => int
    };

Note: the inner_radius cannot be larger then the outer_radius.

=item C<< circle() >>

The circle method provides an area, circumference, and diameter formula.

required: radius

    $x->circle(
        formula => 'area',
        radius  => int
    );

    $x->circle(
        formula => 'circumference',
        radius  => int
    );

    $x->circle(
        formula => 'diameter',
        radius  => int
    );

=item C<< cone() >>

The cone method provides a volume formula.

required: base, height

    $x->cone(
        formula => 'volume',
        base    => int,
        height  => int
    );

=item C<< cube() >>

The cube method provides a surface area and volume formula.

required: a

    $x->cube(
        formula => 'surface_area',
        a       => int
    );

    $x->cube(
        formula => 'volume',
        a       => int
    );

=item C<< ellipse() >>

The ellipse method provides an area and perimeter formula.

required: a, b

    $x->ellipse(
        formula => 'area',
        a       => int,
        b       => int
    );

    $x->ellipse(
        formula => 'perimeter',
        a       => int,
        b       => int
    );

Note: a and b represent radii

=item C<< ellipsoid() >>

The ellipsoid method provides a volume formula.

required: a, b, c

    x->ellipsoid(
        formula => 'volume',
        a       => int,
        b       => int,
        c       => int,
    );

Note: a, b, and c represent radii

=item C<< equilateral_triangle() >>

The equalateral_triangle method provides an area formula.

required: side

    x->equilateral_triangle(
        formula => 'area',
        side    => int,
    );

=item C<< frustum_of_right_circular_cone() >>

The frustum_of_right_circular_cone method provides a lateral_surface_area,
total_surface_area, and volume formula.

required: slant_height, large_radius, small_radius

    x->frustum_of_right_circular_cone(
        formula      => 'lateral_surface_area',
        slant_height => int,
        large_radius => int,
        small_radius => int
    );

required: height, large_radius, small_radius

    x->frustum_of_right_circular_cone(
        formula      => 'total_surface_area',
        height       => int,
        large_radius => int,
        small_radius => int

    );

    x->frustum_of_right_circular_cone(
        formula      => 'volume',
        height       => int,
        large_radius => int,
        small_radius => int
    );

=item C<< parallelogram() >>

The parallelogram method provides an area and perimeter formula.

required: base, height

    x->parallelgram(
        formula => 'area',
        base    => int,
        height  => int
    );

required: a, b

    x->parallelgram(
        formula => 'perimeter',
        a       => int,
        b       => int
    );

Note: a and b are sides

=item C<< rectangle() >>

The rectangle method provides an area and perimeter formula.

required: length, width

    x->rectangle(
        formula => 'area',
        length  => int,
        width   => int
    );

    x->rectangle(
        formula => 'perimeter',
        length  => int,
        width   => int
    );

=item C<< rectangular_solid() >>

The rectangular_solid method provides an and perimeter formula.

required: length, width, height

    x->rectangular_solid(
        formula => 'surface_area',
        length  => int,
        width   => int,
        height  => int
    );

    x->rectangular_solid(
        formula => 'volume',
        length  => int,
        width   => int,
        height  => int
    );

=item C<< rhombus() >>

The rhombus method provides an area formula.

required: a, b

    x->rhombus(
        formula => 'area',
        a       => int,
        b       => int
    );

Note: a and b represent diagonal lines (sides)

=item C<< right_circular_cone() >>

The right_circular_cone method provides a lateral surface area formula.

required: height, radius

    $x->right_circular_cone(
        formula => 'lateral_surface_area', 
        height  => int,
        radius  => int
    );

=item C<< right_circular_cylinder() >>

The right_circular_cylinder method provides a side surface area,
total surface area, and volume formula. 

required: height, radius

    $x->right_circular_cylinder(
        formula => 'lateral_surface_area', 
        height  => int,
        radius  => int
    );

    $x->right_circular_cylinder(
        formula => 'total_surface_area', 
        height  => int,
        radius  => int
    );

    $x->right_circular_cylinder(
        formula => 'volume', 
        height  => int,
        radius  => int
    );

=item C<< sector_of_circle() >>

The sector_of_circle method provides an area formula.

required: theta

    $x->sector_of_circle(
        formula => 'area', 
        theta   => int
    );

Note: theta value should not be greater then 360 (degrees).

=item C<< sphere() >>

The sphere method provides a surface area and volume formula.

required: radius

    $x->sphere(
        formula => 'surface_area', 
        radius  => int
    );

    $x->sphere(
        formula => 'volume', 
        radius  => int
    );

=item C<< square() >>

The square method provides an area and perimeter formula.

required: side

    $x->square(
        formula => 'area', 
        side    => int
    );

    $x->square(
        formula => 'perimeter', 
        side    => int
    );

=item C<< torus() >>

The torus method provides a surface area and volume formula.

    $x->torus(
        formula => 'surface_area', 
        a       => int,
        b       => int
    );

    $x->torus(
        formula => 'volume', 
        a  => int,
        b  => int
    );

Note: a and b represent radii

=item C<< trapezoid() >>

The trapezoid method provides an area and perimeter formula.

required: a, b, and height

    $x->trapezoid(
        formula => 'area', 
        a       => int,
        b       => int,
        height  => int
    );

required a, b, c, and d

    $x->trapezoid(
        formula => 'perimeter', 
        a       => int,
        b       => int,
        c       => int,
        d       => int
    );

=item C<< triangle() >>

The triangle method provides an area and perimeter formula.

    $x->triangle(
        formula => 'area', 
        base    => int,
        height  => int
    );

    $x->triangle(
        formula => 'perimeter', 
        a  => int,
        b  => int,
        c  => int
    );

lib/Geometry/Formula.pm  view on Meta::CPAN


numeric values passed to this fucntion get$self->_cubed and returned

=item C<< _param_check( $name_of_method, %param ) >> 

this method validates the parameters being passed into our formula methods
are properly constructed. 

=back

=head1 DIAGNOSTICS 

 view all matches for this distribution


Git-Raw

 view release on metacpan or  search on metacpan

deps/libgit2/README.md  view on Meta::CPAN

an application in C - then you may be able use an existing binary.
There are packages for the
[vcpkg](https://github.com/Microsoft/vcpkg) and
[conan](https://conan.io/center/libgit2)
package managers.  And libgit2 is available in 
[Homebrew](https://formulae.brew.sh/formula/libgit2) and most Linux
distributions.

However, these versions _may_ be outdated and we recommend using the
latest version if possible.  Thankfully libgit2 is not hard to compile.

 view all matches for this distribution


Git-XS

 view release on metacpan or  search on metacpan

xs/libgit2/deps/zlib/adler32.c  view on Meta::CPAN

{
    unsigned long sum1;
    unsigned long sum2;
    unsigned rem;

    /* the derivation of this formula is left as an exercise for the reader */
    rem = (unsigned)(len2 % BASE);
    sum1 = adler1 & 0xffff;
    sum2 = rem * sum1;
    MOD(sum2);
    sum1 += (adler2 & 0xffff) + BASE - 1;

 view all matches for this distribution


Google-RestApi

 view release on metacpan or  search on metacpan

lib/Google/RestApi/Request.pm  view on Meta::CPAN

A Request is a lightweight base class that provides generic batch
request queuing and response infrastructure. It is used by both
Google Sheets (via SheetsApi4::Request) and Google Docs (via
DocsApi1::Document) to collect requests and distribute responses.

Batch requests are formulated and queued up to be submitted later
via 'submit_requests'. Derived classes must override submit_requests
to implement the actual API call.

The default merge_request returns false (no merging). Sheets overrides
this with its own merge logic for combining compatible requests.

 view all matches for this distribution


Graph-Graph6

 view release on metacpan or  search on metacpan

lib/Graph/Graph6.pm  view on Meta::CPAN

self-loops but no multi-edges.

=cut

# GP-DEFINE  graph6_size_bits_by_sum(n) = sum(j=1,n-1, sum(i=0, j-1, 1));
# GP-DEFINE  graph6_size_bits_formula(n) = n*(n-1)/2;
# GP-Test  vector(100,n, graph6_size_bits_formula(n)) == \
# GP-Test  vector(100,n, graph6_size_bits_by_sum(n))

# GP-DEFINE  graph6_size_bits_formula(n) = n^2/2 - n/2;
# GP-Test  vector(100,n, graph6_size_bits_formula(n)) == \
# GP-Test  vector(100,n, graph6_size_bits_by_sum(n))

=pod

This module reads and writes in a "native" way as integer vertex numbers 0

 view all matches for this distribution


Graph-Maker-Other

 view release on metacpan or  search on metacpan

devel/Hanoi-equal-shortest.pl  view on Meta::CPAN


# GP-DEFINE  read("OEIS-data.gp");
# GP-DEFINE  read("OEIS-data-wip.gp");
# GP-DEFINE  OEIS_check_verbose = 1;

# GP-DEFINE  A107839_formula(n) = \
# GP-DEFINE    polcoeff(lift(Mod('x,'x^2-5*'x+2)^(n+1)),1);
# GP-DEFINE  A107839(n) = {
# GP-DEFINE    n>=0 || error("A107839() is for n>=0");
# GP-DEFINE    A107839_formula(n);
# GP-DEFINE  }
# GP-Test  OEIS_check_func("A107839")
# OEIS_check_func("A107839",'bfile)

# GP-DEFINE  A052984_formula(n) = vecsum(Vec(lift(Mod('x,'x^2-5*'x+2)^(n+1))));
# GP-DEFINE  A052984(n) = {
# GP-DEFINE    n>=0 || error("A052984() is for n>=0");
# GP-DEFINE    A052984_formula(n);
# GP-DEFINE  }
# GP-Test  OEIS_check_func("A052984")
# OEIS_check_func("A052984",,'bfile)

# my(v=OEIS_data("A052984")); \

devel/Hanoi-equal-shortest.pl  view on Meta::CPAN

# not in OEIS: 0.438447187191
# GP-Test  PM_poly(M) == 0
# GP-Test  P*M == 2

#---
# GP-DEFINE  \\ powers formula by Hinz et al, x_n for n+1 discs
# GP-DEFINE  xx(n) = {
# GP-DEFINE    simplify(
# GP-DEFINE    3/(4*sqrt17)
# GP-DEFINE    * ((sqrt17+1)*P^(n+1) - 2*3^(n+1)*sqrt17 + (sqrt17-1)*M^(n+1))
# GP-DEFINE    );
# GP-DEFINE  }
# GP-Test  /* in x_n, A107839 across one pair n within n+1 */ \
# GP-Test  vector(10,n,n--; (xx(n+1) - 3*xx(n))/6) == \
# GP-Test  vector(10,n,n--; A107839(n))
#
# GP-DEFINE  a_formula(n) = xx(n-1);
# GP-DEFINE  a(n) = {
# GP-DEFINE    n>=1 || error("a() is for n>=1");
# GP-DEFINE    xx(n-1);
# GP-DEFINE  }
# GP-Test  vector(4,n, a(n)) == [0, 6, 48, 282]

devel/Hanoi-equal-shortest.pl  view on Meta::CPAN

# GP-Test  /* subgraphs using A107839 = num between subgraphs */ \
# GP-Test  vector(100,n,n++; a(n)) == \
# GP-Test  vector(100,n,n++; 3*a(n-1) + 6*A107839(n-2))
#
# GP-Test  my(n=1); a(n)                   == 0
# GP-Test  my(n=1); 6*A107839_formula(n-2) == 0
# GP-Test  my(n=0); a_formula(n)           == 0
# GP-Test  my(n=0); 6*A107839_formula(n-2) == -3
# GP-Test  my(n=-1); a_formula(n)          == 1
# GP-Test  /* including reversing back earlier */ \
# GP-Test  vector(100,n,n-=20; a_formula(n)) == \
# GP-Test  vector(100,n,n-=20; 3*a_formula(n-1) + 6*A107839_formula(n-2))
# GP-Test  my(n=3); A107839_formula(n-2) == 5  /* my n=3 example */
#
# GP-Test  /* recurrence 8, -17, 6
# GP-Test  vector(100,n,n+=2; a(n)) == \
# GP-Test  vector(100,n,n+=2; 8*a(n-1) - 17*a(n-2) + 6*a(n-3))
# GP-Test  vector(100,n,n-=20; a_formula(n)) == \
# GP-Test  vector(100,n,n-=20; \
# GP-Test          8*a_formula(n-1) - 17*a_formula(n-2) + 6*a_formula(n-3))
#
# GP-Test  /* using A052984 for the Lucas sequence part */ \
# GP-Test  vector(100,n, a(n)) == \
# GP-Test  vector(100,n, (A052984(n) - 3^n)*3/2 )

devel/Hanoi-equal-shortest.pl  view on Meta::CPAN


# GP-DEFINE  \\ compact polmod
# GP-DEFINE  my(p=Mod('x, 'x^2-5*'x+2)); a_compact(n) = (vecsum(Vec(lift(p^(n+1)))) - 3^n)*3/2;
# GP-Test  vector(100,n, a(n)) == \
# GP-Test  vector(100,n, a_compact(n))
# GP-Test  vector(100,n,n-=20; a_formula(n)) == \
# GP-Test  vector(100,n,n-=20; a_compact(n))

# GP-Test  6*5 + 6*3*1 == 48

# GP-Test  /* A107839 across one pair n when making n+1 */ \

 view all matches for this distribution


Graphics-ColorNames-Pantone

 view release on metacpan or  search on metacpan

lib/Graphics/ColorNames/PantoneReport.pm  view on Meta::CPAN

mistaken for the colors of the palette created by Pantone for Designers,
which can be accessed via L<Graphics::ColorNames::Pantone>. I choose
TPX (TPG) over TCX values since ladder are specific to the textile industry
and I assume usage of this module is monitor related. However, when no
TPX (TPG) available we took TCX, since I dont have the exact conversion
formula.

All names are lower case and do not contain space or apostrophes or other
none ASCII characters - the originally named C<"Potter's Clay"> is
here C<"pottersclay"> and C<'Crème de Peche'> => C<'cremedepeche'>.
But you can actually access them as "Potters_Clay" and 'Creme de Peche'

 view all matches for this distribution


Graphics-Framebuffer

 view release on metacpan or  search on metacpan

lib/Graphics/Framebuffer.pm  view on Meta::CPAN


=head2 monochrome

Removes all color information from an image, and leaves everything in greyscale.

It applies the following formula to calculate greyscale:

 grey_color = (red * 0.2126) + (green * 0.7155) + (blue * 0.0722)

=over 4

 view all matches for this distribution


Graphics-MNG

 view release on metacpan or  search on metacpan

include/libmng.h  view on Meta::CPAN

MNG_EXT mng_retcode MNG_DECL mng_set_srgbimplicit    (mng_handle        hHandle);
#endif

/* Gamma settings */
/* only used if you #define MNG_FULL_CMS or #define MNG_GAMMA_ONLY */
/* ... blabla (explain gamma processing a little; eg. formula & stuff) ... */
MNG_EXT mng_retcode MNG_DECL mng_set_viewgamma       (mng_handle        hHandle,
                                                      mng_float         dGamma);
MNG_EXT mng_retcode MNG_DECL mng_set_displaygamma    (mng_handle        hHandle,
                                                      mng_float         dGamma);
MNG_EXT mng_retcode MNG_DECL mng_set_dfltimggamma    (mng_handle        hHandle,

 view all matches for this distribution


Graphics-Penplotter-GcodeXY

 view release on metacpan or  search on metacpan

t/16-ana.t  view on Meta::CPAN

    ok abs($cfg{phi_fwd} - $PI) < 1e-9,    'build_config: phi_fwd=pi for default obs';

    # ang_rad: 2*asin(1/5)*0.9 ~ 2*0.20136*0.9 ~ 0.36245
    my $expected_ang = 2.0 * atan2(0.2, sqrt(1-0.04)) * 0.90;
    ok abs($cfg{ang_rad} - $expected_ang) < 1e-6,
                                            'build_config: default ang_rad matches formula';

    # beta0 = atan2(H, D) = atan2(5,5) = pi/4
    ok abs($cfg{beta0} - $PI/4) < 1e-9,    'build_config: beta0=pi/4 for H=D';

    # elev_rad = beta0 * 0.8

 view all matches for this distribution


Graphics-Toolkit-Color

 view release on metacpan or  search on metacpan

lib/Graphics/Toolkit/Color/Manual/Getter.pod  view on Meta::CPAN

axis names (long or short). For instance if you want to know only the 
difference in brightness between two colors, you choose C<< only => 'lightness' >> 
or C<< only => 'l' >>. This naturally works only if you did also select
I<OKLAB> as the color space or something similar that has a I<lightness> 
axis like I<CIELAB> or I<HSL>. It is allowed to repeat axis names to 
weight their influence on the outcome. For instance to reproduce the formula:
C<< $distance =  sqrt( 3 * $delta_red**2 + 4 * $delta_green**2 + 2 * $delta_blue**2) >>
insert C<< only => [qw/ r r r g g g g b b/] >>.

L<range|Graphics::Toolkit::Color::Manual::Argument/range> requires a range
definition (follow the link for details about that). It will define the

 view all matches for this distribution


Grid-Request

 view release on metacpan or  search on metacpan

lib/Grid/Request.pm  view on Meta::CPAN


    # Iterate over them...
    my $command_count = 1;

    eval { require Grid::Request::JobFormulator };
    my $formulator = Grid::Request::JobFormulator->new();

    foreach my $com_obj (@command_objs) {
        print "Command #" . $command_count . "\n"; 
        my $exe = $com_obj->command();
        my $block_size = $com_obj->block_size();

lib/Grid/Request.pm  view on Meta::CPAN

        foreach my $param_obj (@params) {
            my $param_str = $param_obj->to_string();
            push (@param_strings, $param_str);
        }

        my @invocations = $formulator->formulate($block_size, $exe, @param_strings);
        foreach my $invocations (@invocations) {
            my @cli = @$invocations;
            my @esc_cli = _esc_chars(@cli);
            print join(" ", @esc_cli) . "\n";
        }

 view all matches for this distribution


Groonga-HTTP

 view release on metacpan or  search on metacpan

docs/assets/stylesheets/bootstrap/_glyphicons.scss  view on Meta::CPAN

.glyphicon-king                   { &:before { content: "\e211"; } }
.glyphicon-queen                  { &:before { content: "\e212"; } }
.glyphicon-pawn                   { &:before { content: "\e213"; } }
.glyphicon-bishop                 { &:before { content: "\e214"; } }
.glyphicon-knight                 { &:before { content: "\e215"; } }
.glyphicon-baby-formula           { &:before { content: "\e216"; } }
.glyphicon-tent                   { &:before { content: "\26fa"; } }
.glyphicon-blackboard             { &:before { content: "\e218"; } }
.glyphicon-bed                    { &:before { content: "\e219"; } }
.glyphicon-apple                  { &:before { content: "\f8ff"; } }
.glyphicon-erase                  { &:before { content: "\e221"; } }

 view all matches for this distribution


Gtk2-Ex-GroupBy

 view release on metacpan or  search on metacpan

examples/group-by.pl  view on Meta::CPAN

		],
		[
			'State', 'Country'
		],
	],
	'formula'  => [
		[
			{ field => 'Revenue', formula => 'SUM of'},
			{ field => 'Expenses', formula => 'SUM of'},
			{ field => 'Margin', formula => 'AVG of'},
			{ field => 'Sales', formula => 'SUM of'},
		],
		[
			{ field => 'Costs', formula => 'SUM of'},
			{ field => 'Price', formula => 'AVG of'},
		],
	]
});
$groupby->signal_connect( 'changed' => 
	sub {

examples/group-by.pl  view on Meta::CPAN


sub _make_sql {
	my ($model, $table) = @_;
	print Dumper $model;
	my @group;
	my @formula;
	foreach my $x (@{$model->{'groupby'}->[0]}) {
		push @group, $x;
	}
	foreach my $x (@{$model->{'formula'}->[0]}) {
		my $f = $x->{'formula'};
		$f =~ s/ of$//;
		push @formula, $f.'('.$x->{'field'}.')';
	}
	my $groupstr = join ',', @group;
	my $formulastr = join ',', @formula;
	print Dumper \@group;
	print Dumper \@formula;
	my $query = "select $groupstr,$formulastr from $table group by $groupstr"
		if $groupstr;
	print Dumper $query;
}

 view all matches for this distribution


Gtk2-GoBoard

 view release on metacpan or  search on metacpan

GoBoard.pm  view on Meta::CPAN

   my $w2      = $w - $borderw * 2;
   my $h2      = $h - $borderh * 2;
   my $edge    = ceil $w2 / ($size + 1);
   my $ofs     = $edge * 0.5;

   # we need a certain minimum size, and just fudge some formula here
   return if $w < $size * 5 + 2 + $borderw
          || $h < $size * 6 + 2 + $borderh;

   my @kx = map int ($w2 * $_ / ($size+1) + $borderw + 0.5), 0 .. $size; $self->{kx} = \@kx;
   my @ky = map int ($h2 * $_ / ($size+1) + $borderh + 0.5), 0 .. $size; $self->{ky} = \@ky;

 view all matches for this distribution


Gtk3-ImageView

 view release on metacpan or  search on metacpan

t/4_select.t  view on Meta::CPAN

$event->set_always( 'x', 93 );
$event->set_always( 'y', 67 );
$view->get_tool->button_released($event);

SKIP: {
    skip "I can't figure out the correct formula here which works with HiDPI", 1
      if $view->get('scale-factor') > 1;
    cmp_deeply(
        $view->get_selection,
        {
            x      => num(32),

 view all matches for this distribution


HOI-Comprehensions

 view release on metacpan or  search on metacpan

lib/HOI/Comprehensions.pm  view on Meta::CPAN


=head1 FUNCTIONS

=head2 comp($@)->(@)

For creating a list comprehension object. The formula for computing the elements of
the list is given as a subroutine, following by the generators, in form of name => arrayref, 
name => subroutine or name => comprehension. Comp returns a function which takes all guards 
in form of subroutines. Guard parameters can be left empty if there is no guard.

The variable names for naming the ganerators could be used directly in the computation sub and
all guard subs without strict vars enabled. They have local scope as if they were declared with
keyword 'local' in Perl.

A hashref which holds generator variables as its keys and value of those variables as
its values is passed to the formula subroutine. However, it is recommended to use such
variables directly instead of dereference the hashref.

Generators can be arrayrefs, subroutines or list comprehensions. A subroutine generator should 
return a pair ( elt, done ), where elt is the next element and done is a flag telling whether
the iteration is over, or return a single element.

 view all matches for this distribution


HON-Http-UrlChecker-Service

 view release on metacpan or  search on metacpan

t/resources/t-gone/symptoms.html  view on Meta::CPAN

href="http://national-paranormal-society.org/psychotic-disorders-generalized/" onclick="__gaTracker('send', 'event', 'outbound-article', 'http://national-paranormal-society.org/psychotic-disorders-generalized/', 'psychotic');">psychotic</a> or schizo...
href="http://www.ncbi.nlm.nih.gov/pubmed/23948178" onclick="__gaTracker('send', 'event', 'outbound-article', 'http://www.ncbi.nlm.nih.gov/pubmed/23948178', '10% to 15%');">10% to 15%</a> of the overall population. Tinnitus is not commonly limited to ...
href="http://www.medicinenet.com/brain_tumor/article.htm" onclick="__gaTracker('send', 'event', 'outbound-article', 'http://www.medicinenet.com/brain_tumor/article.htm', 'a cranial tumor');">a cranial tumor</a>, or epilepsy.</p><p>&nbsp;</p><p>Sympto...
href="http://www.webmd.com/a-to-z-guides/understanding-tinnitus-symptoms" onclick="__gaTracker('send', 'event', 'outbound-article', 'http://www.webmd.com/a-to-z-guides/understanding-tinnitus-symptoms', 'be a sign of Meniere’s disease');">be a sign ...
href="http://www.mayoclinic.org/diseases-conditions/tinnitus/basics/risk-factors/con-20021487" onclick="__gaTracker('send', 'event', 'outbound-article', 'http://www.mayoclinic.org/diseases-conditions/tinnitus/basics/risk-factors/con-20021487', 'are m...
href="http://stopmyearsringing.weebly.com/t-gone-tinnitus-remedies.html" onclick="__gaTracker('send', 'event', 'outbound-article', 'http://stopmyearsringing.weebly.com/t-gone-tinnitus-remedies.html', 'brought on by sinus problems');">brought on by si...
class="clear"></div></div></div></div><div
class="sidebar"><div
class="widget widget_text"><div
class="widget-content"><div
class="textwidget"><center><img

 view all matches for this distribution


HPUX-FS

 view release on metacpan or  search on metacpan

contrib/hp_disk_info.cgi  view on Meta::CPAN

print POSTOUT "check_xwrap","\n";
#end of spacer
print POSTOUT "             } if","\n";
print POSTOUT "                } def","\n";
print POSTOUT "%","\n";
print POSTOUT "%------------defines--formula-based","\n";
print POSTOUT "%","\n";
print POSTOUT "","\n";
print POSTOUT "% Define the Font","\n";
print POSTOUT "/HelveticaBold findfont fonth scalefont setfont","\n";
print POSTOUT "%width of cell (will vary depening on maximum string width","\n";

 view all matches for this distribution


( run in 2.466 seconds using v1.01-cache-2.11-cpan-9581c071862 )