Math::Logic 1.19
Sponsored Links
Math::Logic 1.19 Ranking & Summary
File size:
0.012 MB
Platform:
Any Platform
License:
Perl Artistic License
Price:
Downloads:
850
Date added:
2007-07-02
Publisher:
Mark Summerfield
Math::Logic 1.19 description
Math::Logic is a Perl module that provides pure 2, 3 or multi-value logic.
SYNOPSIS
use Math::Logic qw( $TRUE $FALSE $UNDEF $STR_TRUE $STR_FALSE $STR_UNDEF ) ;
# 1 0 -1 TRUE FALSE UNDEF
use Math::Logic :NUM ; # $TRUE $FALSE $UNDEF -- what you normally want
use Math::Logic :ALL ; # All the constants
use Math::Logic :STR ; # $STR_TRUE $STR_FALSE $STR_UNDEF
# 2-degree logic
my $true = Math::Logic->new( -value => $TRUE, -degree => 2 ) ;
my $false = Math::Logic->new( -value => $FALSE, -degree => 2 ) ;
my $x = Math::Logic->new_from_string( TRUE,2 ) ;
print "true" if $true ;
# 3-degree logic (non-propagating)
my $true = Math::Logic->new( -value => $TRUE, -degree => 3 ) ;
my $false = Math::Logic->new( -value => $FALSE, -degree => 3 ) ;
my $undef = Math::Logic->new( -value => $UNDEF, -degree => 3 ) ;
my $x = Math::Logic->new_from_string( FALSE,3 ) ;
print "true" if ( $true | $undef ) == $TRUE ;
# 3-degree logic (propagating)
my $true = Math::Logic->new( -value => $TRUE, -degree => 3, -propagate => 1 ) ;
my $false = Math::Logic->new( -value => $FALSE, -degree => 3, -propagate => 1 ) ;
my $undef = Math::Logic->new( -value => $UNDEF, -degree => 3, -propagate => 1 ) ;
my $x = Math::Logic->new_from_string( ( UNDEF, 3, -propagate ) ) ;
print "undef" if ( $true | $undef ) == $UNDEF ;
# multi-degree logic
my $True = 100 ; # Define our own true
my $False = $FALSE ;
my $true = Math::Logic->new( -value => $True, -degree => $True ) ;
my $very = Math::Logic->new( -value => 67, -degree => $True ) ;
my $fairly = Math::Logic->new( -value => 33, -degree => $True ) ;
my $false = Math::Logic->new( -value => $False, -degree => $True ) ;
my $x = Math::Logic->new_from_string( "25,$True" ) ;
print "maybe" if ( $very | $fairly ) > 50 ;
# We can have arbitrarily complex expressions; the result is a Math::Logic
# object; all arguments must be Math::Logic objects or things which can be
# promoted into such and must all be compatible. The outcome depends on
# which kind of logic is being used.
my $xor = ( $x | $y ) & ( ! ( $x & $y ) ) ;
# This is identical to:
my $xor = $x ^ $y ;
Perls built-in logical operators, and, or, xor and not support 2-value logic. This means that they always produce a result which is either true or false. In fact perl sometimes returns 0 and sometimes returns undef for false depending on the operator and the order of the arguments. For "true" Perl generally returns the first value that evaluated to true which turns out to be extremely useful in practice. Given the choice Perls built-in logical operators are to be preferred -- but when you really want pure 2-degree logic or 3-degree logic or multi-degree logic they are available through this module.
The only 2-degree logic values are 1 (TRUE) and 0 (FALSE).
The only 3-degree logic values are 1 (TRUE), 0 (FALSE) and -1 (UNDEF). Note that UNDEF is -1 not undef!
The only multi-degree logic values are 0 (FALSE)..-degree -- the value of TRUE is equal to the degree, usually 100.
The -degree is the maximum value (except for 2 and 3-degree logic); i.e. logic of n-degree is n+1-value logic, e.g. 100-degree logic has 101 values, 0..100.
Although some useful constants may be exported, this is an object module and the results of logical comparisons are Math::Logic objects.
SYNOPSIS
use Math::Logic qw( $TRUE $FALSE $UNDEF $STR_TRUE $STR_FALSE $STR_UNDEF ) ;
# 1 0 -1 TRUE FALSE UNDEF
use Math::Logic :NUM ; # $TRUE $FALSE $UNDEF -- what you normally want
use Math::Logic :ALL ; # All the constants
use Math::Logic :STR ; # $STR_TRUE $STR_FALSE $STR_UNDEF
# 2-degree logic
my $true = Math::Logic->new( -value => $TRUE, -degree => 2 ) ;
my $false = Math::Logic->new( -value => $FALSE, -degree => 2 ) ;
my $x = Math::Logic->new_from_string( TRUE,2 ) ;
print "true" if $true ;
# 3-degree logic (non-propagating)
my $true = Math::Logic->new( -value => $TRUE, -degree => 3 ) ;
my $false = Math::Logic->new( -value => $FALSE, -degree => 3 ) ;
my $undef = Math::Logic->new( -value => $UNDEF, -degree => 3 ) ;
my $x = Math::Logic->new_from_string( FALSE,3 ) ;
print "true" if ( $true | $undef ) == $TRUE ;
# 3-degree logic (propagating)
my $true = Math::Logic->new( -value => $TRUE, -degree => 3, -propagate => 1 ) ;
my $false = Math::Logic->new( -value => $FALSE, -degree => 3, -propagate => 1 ) ;
my $undef = Math::Logic->new( -value => $UNDEF, -degree => 3, -propagate => 1 ) ;
my $x = Math::Logic->new_from_string( ( UNDEF, 3, -propagate ) ) ;
print "undef" if ( $true | $undef ) == $UNDEF ;
# multi-degree logic
my $True = 100 ; # Define our own true
my $False = $FALSE ;
my $true = Math::Logic->new( -value => $True, -degree => $True ) ;
my $very = Math::Logic->new( -value => 67, -degree => $True ) ;
my $fairly = Math::Logic->new( -value => 33, -degree => $True ) ;
my $false = Math::Logic->new( -value => $False, -degree => $True ) ;
my $x = Math::Logic->new_from_string( "25,$True" ) ;
print "maybe" if ( $very | $fairly ) > 50 ;
# We can have arbitrarily complex expressions; the result is a Math::Logic
# object; all arguments must be Math::Logic objects or things which can be
# promoted into such and must all be compatible. The outcome depends on
# which kind of logic is being used.
my $xor = ( $x | $y ) & ( ! ( $x & $y ) ) ;
# This is identical to:
my $xor = $x ^ $y ;
Perls built-in logical operators, and, or, xor and not support 2-value logic. This means that they always produce a result which is either true or false. In fact perl sometimes returns 0 and sometimes returns undef for false depending on the operator and the order of the arguments. For "true" Perl generally returns the first value that evaluated to true which turns out to be extremely useful in practice. Given the choice Perls built-in logical operators are to be preferred -- but when you really want pure 2-degree logic or 3-degree logic or multi-degree logic they are available through this module.
The only 2-degree logic values are 1 (TRUE) and 0 (FALSE).
The only 3-degree logic values are 1 (TRUE), 0 (FALSE) and -1 (UNDEF). Note that UNDEF is -1 not undef!
The only multi-degree logic values are 0 (FALSE)..-degree -- the value of TRUE is equal to the degree, usually 100.
The -degree is the maximum value (except for 2 and 3-degree logic); i.e. logic of n-degree is n+1-value logic, e.g. 100-degree logic has 101 values, 0..100.
Although some useful constants may be exported, this is an object module and the results of logical comparisons are Math::Logic objects.
Math::Logic 1.19 Screenshot
Math::Logic 1.19 Keywords
TRUE
FALSE
UNDEF
STR
Logic 1.19
Perl module
logic
new
3
2
X
Perl
Math::Logic
MathLogic
Math::Logic 1.19
Libraries
Bookmark Math::Logic 1.19
Math::Logic 1.19 Copyright
WareSeeker periodically updates pricing and software information of Math::Logic 1.19 full version from the publisher, so some information may be slightly out-of-date. You should confirm all information before relying on it. Software piracy is theft, Using crack, password, serial numbers, registration codes, key generators is illegal and prevent future development of Math::Logic 1.19 Edition. Download links are directly from our publisher sites, torrent files or links from rapidshare.com, yousendit.com or megaupload.com are not allowed
Featured Software
Want to place your software product here?
Please contact us for consideration.
Contact WareSeeker.com
Related Information
Related Software
Math::BigInt is an arbitrary size integer/float math package. Free Download
Math::GSL is a Perl module for the GNU Scientific Library. Free Download
Math::Logic::Predicate is a Perl module to manage and query a predicate assertion database. Free Download
Math::BigInt::Calc is a pure Perl module to support Math::BigInt. Free Download
Math::TotalBuilder is a Perl module to build a whole total out of valued pieces. Free Download
Math::Complex is a Perl module with complex numbers and associated mathematical functions. Free Download
Math::ODE Perl module allows you to solve N-th Order Ordinary Differential Equations with as little pain as possible. Free Download
Math::TotalBuilder::Common is a Perl module with common unit sets for building totals. Free Download
Latest Software
Popular Software
Favourite Software