view release on metacpan or search on metacpan
ext/xxHash/doc/xxhash_spec.md view on Meta::CPAN
It is evenly divided into 4 _lanes_, of 4 bytes each.
The first lane is used to update accumulator 1, the second lane is used to update accumulator 2, and so on.
Each lane read its associated 32-bit value using __little-endian__ convention.
For each {lane, accumulator}, the update process is called a _round_, and applies the following formula:
```c
accN = accN + (laneN * PRIME32_2);
accN = accN <<< 13;
accN = accN * PRIME32_1;
ext/xxHash/doc/xxhash_spec.md view on Meta::CPAN
Input is consumed one full stripe at a time. Step 2 is looped as many times as necessary to consume the whole input, except for the last remaining bytes which cannot form a stripe (< 16 bytes).
When that happens, move to step 3.
### Step 3. Accumulator convergence
All 4 lane accumulators from the previous steps are merged to produce a single remaining accumulator of the same width (32-bit). The associated formula is as follows:
```c
acc = (acc1 <<< 1) + (acc2 <<< 7) + (acc3 <<< 12) + (acc4 <<< 18);
```
ext/xxHash/doc/xxhash_spec.md view on Meta::CPAN
It is evenly divided into 4 _lanes_, of 8 bytes each.
The first lane is used to update accumulator 1, the second lane is used to update accumulator 2, and so on.
Each lane read its associated 64-bit value using __little-endian__ convention.
For each {lane, accumulator}, the update process is called a _round_, and applies the following formula:
```c
round(accN,laneN):
accN = accN + (laneN * PRIME64_2);
accN = accN <<< 31;
ext/xxHash/doc/xxhash_spec.md view on Meta::CPAN
Input is consumed one full stripe at a time. Step 2 is looped as many times as necessary to consume the whole input, except for the last remaining bytes which cannot form a stripe (< 32 bytes).
When that happens, move to step 3.
### Step 3. Accumulator convergence
All 4 lane accumulators from previous steps are merged to produce a single remaining accumulator of same width (64-bit). The associated formula is as follows.
Note that accumulator convergence is more complex than 32-bit variant, and requires to define another function called _mergeAccumulator()_:
```c
mergeAccumulator(acc,accN):
acc = acc xor round(0, accN);
acc = acc * PRIME64_1;
return acc + PRIME64_4;
```
which is then used in the convergence formula:
```c
acc = (acc1 <<< 1) + (acc2 <<< 7) + (acc3 <<< 12) + (acc4 <<< 18);
acc = mergeAccumulator(acc, acc1);
acc = mergeAccumulator(acc, acc2);
view all matches for this distribution
view release on metacpan or search on metacpan
src/ltm/mp_prime_strong_lucas_selfridge.c view on Meta::CPAN
U_1 and V_1; the FOR loop calculates in succession U_2 and V_2,
U_4 and V_4, U_8 and V_8, etc. If the corresponding bits
(1, 2, 3, ...) of t are on (the zero bit having been accounted
for in the initialization of U and V), these values are then
combined with the previous totals for U and V, using the
composition formulas for addition of indices. */
mp_set(&Uz, 1uL); /* U=U_1 */
mp_set(&Vz, (mp_digit)P); /* V=V_1 */
mp_set(&U2mz, 1uL); /* U_1 */
mp_set(&V2mz, (mp_digit)P); /* V_1 */
src/ltm/mp_prime_strong_lucas_selfridge.c view on Meta::CPAN
p. 130. The condition is NECESSARY; otherwise the test will
return MP_NO negatives---e.g., the primes 29 and 2000029 will be
returned as composite. */
/* Otherwise, we must compute V_2d, V_4d, V_8d, ..., V_{2^(s-1)*d}
by repeated use of the formula V_2m = V_m*V_m - 2*Q^m. If any of
these are congruent to 0 mod N, then N is a prime or a strong
Lucas pseudoprime. */
/* Initialize 2*Q^(d*2^r) for V_2m */
if ((err = mp_mul_2(&Qkdz, &Q2kdz)) != MP_OKAY) goto LBL_LS_ERR;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/CtrlO/Crypt/XkcdPassword/Wordlist/en_gb.pm view on Meta::CPAN
format
formation
formative
former
formerly
formula
formulae
formulate
forsake
forsaken
forsook
forswear
forswore
view all matches for this distribution
view release on metacpan or search on metacpan
fulldemo/help/menu.help view on Meta::CPAN
The variable </B>$returnValue<!B> is an integer value which represents the
selected item. The calculation of this value is determined as follows:
(100 * Current Title ) + Current Subtitle
To extract the correct menu item from this value use the following formula:
$menuList = int ( $returnValue / 100 );
$menuItem = ($returnValue % 100 );
You can then dereference the string value from the array using the above two
calculations.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DB/Object/Fields/Unknown.pm view on Meta::CPAN
v0.2.0
=head1 DESCRIPTION
This class represents an unknown field. This happens when L<DB::Object::Fields> cannot find a given field used in a SQL query. Instead of returning an error (undef), it returns this object, which is then ignored when he query is formulated.
A warning is issued by L<DB::Object::Fields> when a field is unknown, so make sure to check your error output or your error log.
=head1 METHODS
view all matches for this distribution
view release on metacpan or search on metacpan
Makefile.PL view on Meta::CPAN
# Debian, according to Roderick Schertler <roderick@argon.org>, 1999-09.
# May also, or instead, need -I\$(SITEARCHEXP)/auto/DBI; this was
# reported by Joachim Schrod <jschrod@acm.org> in January 1998 on AIX.
# And on 2002-07-03, Roderick Schertler also reported that we may need
# INSTALLVENDORARCH sometimes (Debian again), and gave the join/map
# formulation without listing SITEARCHEXP. On my Solaris 7 box with my
# build of Perl 5.8.0, INSTALLVENDORARCH is empty, and SITEARCHEXP is
# the same as INSTALLSITEARCH, but that doesn't do any harm.
#
# ??Should we use $Config{installarchlib} etc, and check for what exists?
# ??Can we sensibly check for uniqueness of directory names?
view all matches for this distribution
view release on metacpan or search on metacpan
/*
** The second parameter to sqlite3BtreeGetMeta or sqlite3BtreeUpdateMeta
** should be one of the following values. The integer values are assigned
** to constants so that the offset of the corresponding field in an
** SQLite database header may be found using the following formula:
**
** offset = 36 + (idx * 4)
**
** For example, the free-page-count field is located at byte offset 36 of
** the database file header. The incr-vacuum-flag field is located at
** This is not a real checksum. It is really just the sum of the
** random initial value (pPager->cksumInit) and every 200th byte
** of the page data, starting with byte offset (pPager->pageSize%200).
** Each byte is interpreted as an 8-bit unsigned integer.
**
** Changing the formula used to compute this checksum results in an
** incompatible journal file format.
**
** If journal corruption occurs due to a power failure, the most likely
** scenario is that one end or the other of the record will be changed.
** It is much less likely that the two ends of the journal record will be
** If the index value yy_shift_ofst[S]+X is out of range or if the value
** yy_lookahead[yy_shift_ofst[S]+X] is not equal to X or if yy_shift_ofst[S]
** is equal to YY_SHIFT_USE_DFLT, it means that the action is not in the table
** and that yy_default[S] should be used instead.
**
** The formula above is for computing the action when the lookahead is
** a terminal symbol. If the lookahead is a non-terminal (as occurs after
** a reduce action) then the yy_reduce_ofst[] array is used in place of
** the yy_shift_ofst[] array and YY_REDUCE_USE_DFLT is used in place of
** YY_SHIFT_USE_DFLT.
**
view all matches for this distribution
view release on metacpan or search on metacpan
/*
** The second parameter to sqlite3BtreeGetMeta or sqlite3BtreeUpdateMeta
** should be one of the following values. The integer values are assigned
** to constants so that the offset of the corresponding field in an
** SQLite database header may be found using the following formula:
**
** offset = 36 + (idx * 4)
**
** For example, the free-page-count field is located at byte offset 36 of
** the database file header. The incr-vacuum-flag field is located at
** This is not a real checksum. It is really just the sum of the
** random initial value (pPager->cksumInit) and every 200th byte
** of the page data, starting with byte offset (pPager->pageSize%200).
** Each byte is interpreted as an 8-bit unsigned integer.
**
** Changing the formula used to compute this checksum results in an
** incompatible journal file format.
**
** If journal corruption occurs due to a power failure, the most likely
** scenario is that one end or the other of the record will be changed.
** It is much less likely that the two ends of the journal record will be
** Given state S and lookahead X, the action is computed as either:
**
** (A) N = yy_action[ yy_shift_ofst[S] + X ]
** (B) N = yy_default[S]
**
** The (A) formula is preferred. The B formula is used instead if
** yy_lookahead[yy_shift_ofst[S]+X] is not equal to X.
**
** The formulas above are for computing the action when the lookahead is
** a terminal symbol. If the lookahead is a non-terminal (as occurs after
** a reduce action) then the yy_reduce_ofst[] array is used in place of
** the yy_shift_ofst[] array.
**
** The following are the tables generated in this section:
** nPhaseOneStep:
** If the RBU database contains an rbu_count table, this value is set to
** a running estimate of the number of b-tree operations required to
** finish populating the *-oal file. This allows the sqlite3_bp_progress()
** API to calculate the permyriadage progress of populating the *-oal file
** using the formula:
**
** permyriadage = (10000 * nProgress) / nPhaseOneStep
**
** nPhaseOneStep is initialized to the sum of:
**
** Given state S and lookahead X, the action is computed as either:
**
** (A) N = fts5yy_action[ fts5yy_shift_ofst[S] + X ]
** (B) N = fts5yy_default[S]
**
** The (A) formula is preferred. The B formula is used instead if
** fts5yy_lookahead[fts5yy_shift_ofst[S]+X] is not equal to X.
**
** The formulas above are for computing the action when the lookahead is
** a terminal symbol. If the lookahead is a non-terminal (as occurs after
** a reduce action) then the fts5yy_reduce_ofst[] array is used in place of
** the fts5yy_shift_ofst[] array.
**
** The following are the tables generated in this section:
for(i=0; rc==SQLITE_OK && i<nPhrase; i++){
sqlite3_int64 nHit = 0;
rc = pApi->xQueryPhrase(pFts, i, (void*)&nHit, fts5CountCb);
if( rc==SQLITE_OK ){
/* Calculate the IDF (Inverse Document Frequency) for phrase i.
** This is done using the standard BM25 formula as found on wikipedia:
**
** IDF = log( (N - nHit + 0.5) / (nHit + 0.5) )
**
** where "N" is the total number of documents in the set and nHit
** is the number that contain at least one instance of the phrase
Fts5Context *pFts, /* First arg to pass to pApi functions */
sqlite3_context *pCtx, /* Context for returning result/error */
int nVal, /* Number of values in apVal[] array */
sqlite3_value **apVal /* Array of trailing arguments */
){
const double k1 = 1.2; /* Constant "k1" from BM25 formula */
const double b = 0.75; /* Constant "b" from BM25 formula */
int rc = SQLITE_OK; /* Error code */
double score = 0.0; /* SQL function return value */
Fts5Bm25Data *pData; /* Values allocated/calculated once only */
int i; /* Iterator variable */
int nInst = 0; /* Value returned by xInstCount() */
view all matches for this distribution
view release on metacpan or search on metacpan
sqlite-amalgamation.c view on Meta::CPAN
** If the index value yy_shift_ofst[S]+X is out of range or if the value
** yy_lookahead[yy_shift_ofst[S]+X] is not equal to X or if yy_shift_ofst[S]
** is equal to YY_SHIFT_USE_DFLT, it means that the action is not in the table
** and that yy_default[S] should be used instead.
**
** The formula above is for computing the action when the lookahead is
** a terminal symbol. If the lookahead is a non-terminal (as occurs after
** a reduce action) then the yy_reduce_ofst[] array is used in place of
** the yy_shift_ofst[] array and YY_REDUCE_USE_DFLT is used in place of
** YY_SHIFT_USE_DFLT.
**
view all matches for this distribution
view release on metacpan or search on metacpan
/*
** The second parameter to sqlite3BtreeGetMeta or sqlite3BtreeUpdateMeta
** should be one of the following values. The integer values are assigned
** to constants so that the offset of the corresponding field in an
** SQLite database header may be found using the following formula:
**
** offset = 36 + (idx * 4)
**
** For example, the free-page-count field is located at byte offset 36 of
** the database file header. The incr-vacuum-flag field is located at
** This is not a real checksum. It is really just the sum of the
** random initial value (pPager->cksumInit) and every 200th byte
** of the page data, starting with byte offset (pPager->pageSize%200).
** Each byte is interpreted as an 8-bit unsigned integer.
**
** Changing the formula used to compute this checksum results in an
** incompatible journal file format.
**
** If journal corruption occurs due to a power failure, the most likely
** scenario is that one end or the other of the record will be changed.
** It is much less likely that the two ends of the journal record will be
** Given state S and lookahead X, the action is computed as either:
**
** (A) N = yy_action[ yy_shift_ofst[S] + X ]
** (B) N = yy_default[S]
**
** The (A) formula is preferred. The B formula is used instead if
** yy_lookahead[yy_shift_ofst[S]+X] is not equal to X.
**
** The formulas above are for computing the action when the lookahead is
** a terminal symbol. If the lookahead is a non-terminal (as occurs after
** a reduce action) then the yy_reduce_ofst[] array is used in place of
** the yy_shift_ofst[] array.
**
** The following are the tables generated in this section:
** nPhaseOneStep:
** If the RBU database contains an rbu_count table, this value is set to
** a running estimate of the number of b-tree operations required to
** finish populating the *-oal file. This allows the sqlite3_bp_progress()
** API to calculate the permyriadage progress of populating the *-oal file
** using the formula:
**
** permyriadage = (10000 * nProgress) / nPhaseOneStep
**
** nPhaseOneStep is initialized to the sum of:
**
** Given state S and lookahead X, the action is computed as either:
**
** (A) N = fts5yy_action[ fts5yy_shift_ofst[S] + X ]
** (B) N = fts5yy_default[S]
**
** The (A) formula is preferred. The B formula is used instead if
** fts5yy_lookahead[fts5yy_shift_ofst[S]+X] is not equal to X.
**
** The formulas above are for computing the action when the lookahead is
** a terminal symbol. If the lookahead is a non-terminal (as occurs after
** a reduce action) then the fts5yy_reduce_ofst[] array is used in place of
** the fts5yy_shift_ofst[] array.
**
** The following are the tables generated in this section:
for(i=0; rc==SQLITE_OK && i<nPhrase; i++){
sqlite3_int64 nHit = 0;
rc = pApi->xQueryPhrase(pFts, i, (void*)&nHit, fts5CountCb);
if( rc==SQLITE_OK ){
/* Calculate the IDF (Inverse Document Frequency) for phrase i.
** This is done using the standard BM25 formula as found on wikipedia:
**
** IDF = log( (N - nHit + 0.5) / (nHit + 0.5) )
**
** where "N" is the total number of documents in the set and nHit
** is the number that contain at least one instance of the phrase
Fts5Context *pFts, /* First arg to pass to pApi functions */
sqlite3_context *pCtx, /* Context for returning result/error */
int nVal, /* Number of values in apVal[] array */
sqlite3_value **apVal /* Array of trailing arguments */
){
const double k1 = 1.2; /* Constant "k1" from BM25 formula */
const double b = 0.75; /* Constant "b" from BM25 formula */
int rc; /* Error code */
double score = 0.0; /* SQL function return value */
Fts5Bm25Data *pData; /* Values allocated/calculated once only */
int i; /* Iterator variable */
int nInst = 0; /* Value returned by xInstCount() */
view all matches for this distribution
view release on metacpan or search on metacpan
** If the index value yy_shift_ofst[S]+X is out of range or if the value
** yy_lookahead[yy_shift_ofst[S]+X] is not equal to X or if yy_shift_ofst[S]
** is equal to YY_SHIFT_USE_DFLT, it means that the action is not in the table
** and that yy_default[S] should be used instead.
**
** The formula above is for computing the action when the lookahead is
** a terminal symbol. If the lookahead is a non-terminal (as occurs after
** a reduce action) then the yy_reduce_ofst[] array is used in place of
** the yy_shift_ofst[] array and YY_REDUCE_USE_DFLT is used in place of
** YY_SHIFT_USE_DFLT.
**
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBIx/Class/Manual/Cookbook.pod view on Meta::CPAN
return $rs->pager();
=head2 Complex WHERE clauses
Sometimes you need to formulate a query using specific operators:
my @albums = $schema->resultset('Album')->search({
artist => { 'like', '%Lamb%' },
title => { 'like', '%Fear of Fours%' },
});
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBIx/Compare/ContentChecksum/mysql.pm view on Meta::CPAN
=head1 DISCLAIMER
I have no idea how big a concatenated value would have to be to cause havoc with your system..... I took care to gradually test the limits of my own system before I risked crashing everything spectacularly, and would suggest you do the same. I accept...
Having said that, a dual-Quad-core-Xeon MySQL server with 4Gb of RAM and a C<group_concat_max_len> value of 1,000,000,000 was happy (albeit a bit slow) concatenating 100,000,000 rows of a varchar(20) with an average length of 7.5. This is only a guid...
=head1 SEE ALSO
L<DBIx::Compare|DBIx::Compare>
view all matches for this distribution
view release on metacpan or search on metacpan
DBIx/DBStag.pm view on Meta::CPAN
"SELECT $pk FROM $joinpaths{$ptbl}".
" WHERE $w";
push(@W,
"[ $pk IN ($subselect) ]");
}
# produce example formula for non-ints
if ($n->data eq 's') {
push(@EXAMPLE,
"$v => SELECT DISTINCT $tbl FROM $ptbl");
}
}
view all matches for this distribution
view release on metacpan or search on metacpan
# from t1, outer t2, t3 where t1.mca = t2.mca and t2.mcb = t3.mcb
# group by t1.c2, t1.c3, t1.mca
#
# As long as all the joins are between t1 and the other tables, the query
# is fast. To handle the situation when they're not, needed to work out
# another query formulation. Doing it in 2 queries with a temporary table
# works:
#
# select min(t2.ca) aa, min(t2.cb) ab, t1.ca ac, t1.cb ad,
# t1.mca ae, min(t2.mcb) af
# from t1, outer t2 where t1.mca = t2.mca
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBIx/Perlish.pm view on Meta::CPAN
not already provide, a new sub or method is added into it.
=item Object-relational mapping
One carefully designs the database schema and an associated collection
of classes, then formulates the design in terms of any of the existing
object-relational mapper modules like C<Class::DBI>, C<DBIx::Class>
or C<Tangram>, then uses objects which perform all necessary queries
under the hood. This approach is even cleaner than "clean and tidy"
above, but it has other issues. Some schemas do not map well into
the OO space. Typically, the resulting performance is an issue
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBIx/Web.pm view on Meta::CPAN
# ,-rvcCkoState=>[fld=>state ] # check-out state of record
# ,-rvcDelState=>[fld=>state ] # deleted state of record
# Record File Attachments rooles:
,-rfa =>1 # switch on
# ,-rfdName =>sub{} # 'rfdName' formula for key processing
# Record ID References
# ,-ridRef =>[] # reference fields
# Record Manipulation Triggers:
lib/DBIx/Web.pm view on Meta::CPAN
}
sub dbiSel { # Select records from database
# -select =>ALL, DISTINCT, DISTINCTROW, STRAIGHT_JOIN, HIGH_PRIORITY, SQL_SMALL_RESULT
# -data =>[fields] | [field, [field=>alias], {-fld=>alias, -expr=>formula,..}]
# -table =>[tables] | [[table=>alias], [table=>alias,join]]
# -join[01] =>string
# -join =>string
# -join2 =>string
# -key =>{field=>value}
lib/DBIx/Web.pm view on Meta::CPAN
sub cgiQInherit { # Inherit cgi query attributes if needed
my($s, $q, $qm, $tm) =@_; # (self, query, meta, table meta, table query)
# use local @$q{qw(-meta -field -data -display -order -keyord)} =@$q{qw(-meta -field -data -display -order -keyord)};
# meta - process -query specification - fill inheritance for formulas
# !meta - process request formed - fill metadata for cgiList
$tm = !$q->{-table}
? $tm
: !ref($q->{-table}) && ($q->{-table} =~/^([^\s]+)/)
? $_[0]->{-form}->{$1} || $_[0]->mdeTable($1)
view all matches for this distribution
view release on metacpan or search on metacpan
#Ints has been replaced by 'NoQuote', but we maintain
#backward compatibility
foreach (keys %{$p{'Ints'}}){ $p{'NoQuote'}->{$_} = 1; }
#formulate the sql
my $field_names = join (', ', sort (keys %{$p{Insert}}));
foreach (sort (keys %{$p{Insert}})){
if (exists($p{'NoQuote'}->{$_})){
push (@vals, $p{Insert}->{$_});
}else{
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DB_File/DB_Database.pm view on Meta::CPAN
opened when open the database file, and updated automatically when writing the database file.
=item create_index
Create index file for one field. Default permits of the index file is 0640. 'name' is the index
tag name, 'key' is the formula for indexing. For example:
'key' => 'Age' # index by the age, from young to old
'key' => '-Age' # index by the age, from old to young
'key' => '-Age(3)+Name' # index by the age(up to 999),then name; from old to young,then from A to Z
'key' => '-Age(3)+-Name' # index by the age(up to 999),then name; from old to young,then from Z to A
view all matches for this distribution
view release on metacpan or search on metacpan
differentiate this between a failure form the DB_File layer.
=item lockfile_mode
determines the mode for the sysopen call in opening
the lockfile. The default mode will be formulated to allow anyone that
can read or write the DB_File permission to read and write the lockfile.
(This is because some systems may require that one have write access to
a file to lock it for reading, I understand.) The umask will be prevented
from applying to this mode.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DDG/Meta/Information.pm view on Meta::CPAN
dates
entertainment
facts
finance
food
formulas
forums
geography
ids
language
location_aware
view all matches for this distribution
view release on metacpan or search on metacpan
B<DEPRECATED> in favor of raw L<HTTP|/"HTTP Server/Client Protocol">.
L<DTA::CAB::Server::XmlRpc|DTA::CAB::Server::XmlRpc> implements a simple
XML-RPC HTTP server which can be used to handle analysis requests for
one of a user-specified set of L<DTA::CAB::Analyzer|DTA::CAB::Analyzer>
objects formulated as XML-RPC procedure calls.
L<DTA::CAB::Client::XmlRpc|DTA::CAB::Client::XmlRpc> provides a wrapper class
for querying such a server.
See L<DTA::CAB::XmlRpcProtocol>
for an brief overview of the procedures available
and an XML-RPCish rehash of the DTA::CAB L<data model|/"Data Model">.
view all matches for this distribution
view release on metacpan or search on metacpan
public/css/bootstrap-3/bootstrap.css view on Meta::CPAN
content: "\e214";
}
.glyphicon-knight:before {
content: "\e215";
}
.glyphicon-baby-formula:before {
content: "\e216";
}
.glyphicon-tent:before {
content: "\26fa";
}
view all matches for this distribution
view release on metacpan or search on metacpan
public/css/bootstrap-3/bootstrap.css view on Meta::CPAN
content: "\e214";
}
.glyphicon-knight:before {
content: "\e215";
}
.glyphicon-baby-formula:before {
content: "\e216";
}
.glyphicon-tent:before {
content: "\26fa";
}
view all matches for this distribution
view release on metacpan or search on metacpan
share/assets/dash_core_components/async~plotlyjs.js view on Meta::CPAN
(window.webpackJsonpdash_core_components=window.webpackJsonpdash_core_components||[]).push([[5],{685:function(t,e){!function(r){"object"==typeof e&&void 0!==t?t.exports=r():"function"==typeof define&&define.amd?define([],r):("undefined"!=typeof windo...
view all matches for this distribution
view release on metacpan or search on metacpan
databb-boost/boost/config/auto_link.hpp view on Meta::CPAN
Algorithm:
~~~~~~~~~~
Libraries for Borland and Microsoft compilers are automatically
selected here, the name of the lib is selected according to the following
formula:
BOOST_LIB_PREFIX
+ BOOST_LIB_NAME
+ "_"
+ BOOST_LIB_TOOLSET
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/Float.pm view on Meta::CPAN
my $max_number = $have_infinite ? $pos_infinity : $max_finite;
_mk_constant("max_number", $max_number);
my($have_nan, $nan);
foreach my $nan_formula (
'$have_infinite && $pos_infinity/$pos_infinity',
'log(-1.0)',
'0.0/0.0',
'"nan"') {
my $maybe_nan =
eval 'local $SIG{__DIE__}; local $SIG{__WARN__} = sub { }; '.
$nan_formula;
if(do { local $SIG{__WARN__} = sub { }; $maybe_nan != $maybe_nan }) {
$have_nan = 1;
$nan = $maybe_nan;
_mk_constant("nan", $nan);
last;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/Formula.pm view on Meta::CPAN
'(' => {method => 'bracket_left',},
')' => {method => 'bracket_right',},
);
has 'variables' => (is => 'rw', isa => 'ArrayRef', default => sub {[]});
has 'formula' => (is => 'ro', isa => 'Str', default => sub {[]});
has '_tokens' => (is => 'ro', isa => 'ArrayRef', lazy_build => 1,);
has '_rpn' => (is => 'ro', isa => 'ArrayRef', lazy_build => 1,);
has '_op_indent' => (is => 'rw', isa => 'Int', default => 0,);
has 'used_variables' => (is => 'ro', isa => 'ArrayRef', lazy_build => 1,);
lib/Data/Formula.pm view on Meta::CPAN
sub _build__tokens {
my ($self) = @_;
my @tokens;
my $formula = $self->formula;
$formula =~ s/\s//g;
my $op_regexp = join('', map {q{\\} . $_} keys %operators);
my $op_regexp_with_variable = '^([^' . $op_regexp . ']*?)([' . $op_regexp . '])';
while ($formula =~ m/$op_regexp_with_variable/) {
my $variable = $1;
my $operator = $2;
push(@tokens, $variable) if length($variable);
push(@tokens, $operator);
$formula = substr($formula, length($variable . $operator));
}
if (length($formula)) {
push(@tokens, $formula);
}
return [map {$_ =~ m/^[0-9]+$/ ? $_ + 0 : $_} @tokens];
}
lib/Data/Formula.pm view on Meta::CPAN
=encoding utf8
=head1 NAME
Data::Formula - formulas evaluation and calculation
=head1 SYNOPSIS
my $df = Data::Formula->new(
formula => 'var212 - var213 * var314 + var354',
);
my $val = $df->calculate(
var212 => 5,
var213 => 10,
var314 => 7,
lib/Data/Formula.pm view on Meta::CPAN
);
# 5-(10*7)+100
my $df = Data::Formula->new(
variables => [qw( var212 var213 n274 n294 var314 var334 var354 var374 var394 )],
formula => 'var212 - var213 + var314 * (var354 + var394) - 10',
on_error => undef,
on_missing_token => 0,
);
my $used_variables = $df->used_variables;
# [ var212 var213 var314 var354 var394 ]
lib/Data/Formula.pm view on Meta::CPAN
);
# 5-10+2*(3+9)-10
=head1 DESCRIPTION
evaluate and calulate formulas with variables of the type var212 - var213 + var314 * (var354 + var394) - 10
=head1 ACCESSORS
=head2 formula
Formula for calculation. Required.
=head2 on_error
lib/Data/Formula.pm view on Meta::CPAN
Optional, if not set L</calculate()> will throw an exception in case of an error.
=head2 on_missing_token
Sets what should happen when there is a missing/unknown token found in
formula.
Can be a scalar value, like fixed number, or a code ref
that will be executed with token name as argument.
Optional, if not set L</calculate()> will throw an exception with unknown tokens.
lib/Data/Formula.pm view on Meta::CPAN
=head2 new()
Object constructor.
my $df = Data::Formula->new(
formula => 'var212 - var213 * var314 + var354',
);
=head2 used_variables()
return array with variables used in formula
=head2 calculate()
Evaluate formula with values for variables, returns calculated value.
Will throw expetion on division by zero of unknown variables, unless
changes by L</on_error> or L</on_missing_token>
=head1 AUTHOR
view all matches for this distribution
view release on metacpan or search on metacpan
* This can be controlled via the @ref XXH_VECTOR macro, but it automatically
* selects the best version according to predefined macros. For the x86 family, an
* automatic runtime dispatcher is included separately in @ref xxh_x86dispatch.c.
*
* XXH3 implementation is portable:
* it has a generic C90 formulation that can be compiled on any platform,
* all implementations generate exactly the same hash value on all platforms.
* Starting from v0.8.0, it's also labelled "stable", meaning that
* any future version will also generate the same hash value.
*
* XXH3 offers 2 variants, _64bits and _128bits.
view all matches for this distribution