Skip to content

Commit

Permalink
Merge pull request #89 from JordanRL/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
JordanRL committed Jun 26, 2021
2 parents 4464ce1 + 0c0d881 commit 893faab
Show file tree
Hide file tree
Showing 188 changed files with 25,355 additions and 4,780 deletions.
6 changes: 2 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
language: php
php:
- 7.3
- 7.4
- 8.0

install:
- composer update
Expand All @@ -14,5 +13,4 @@ script:
- php vendor/bin/phpunit

after_success:
- wget https://scrutinizer-ci.com/ocular.phar
- php ocular.phar code-coverage:upload --format=php-clover build/logs/coverage.clover
- php vendor/bin/ocular code-coverage:upload --format=php-clover build/logs/coverage.clover
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![Build Status](https://travis-ci.org/JordanRL/Fermat.svg?branch=master)](https://travis-ci.org/JordanRL/Fermat) [![Code Coverage](https://scrutinizer-ci.com/g/JordanRL/Fermat/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/JordanRL/Fermat/?branch=master) [![Latest Stable Version](https://poser.pugx.org/samsara/fermat/v/stable)](https://packagist.org/packages/samsara/fermat) [![Total Downloads](https://poser.pugx.org/samsara/fermat/downloads)](https://packagist.org/packages/samsara/fermat) [![Latest Unstable Version](https://poser.pugx.org/samsara/fermat/v/unstable)](https://packagist.org/packages/samsara/fermat) [![License](https://poser.pugx.org/samsara/fermat/license)](https://packagist.org/packages/samsara/fermat)

**This project is unit tested against 7.2+, and merges are not accepted unless the tests pass.**
**This project is unit tested against 8.0, and merges are not accepted unless the tests pass.**

## Installation

Expand All @@ -22,6 +22,16 @@ Or include it in your `composer.json` file:

The project namespace is `Samsara\Fermat\*`. You can view the project on [Packagist](https://packagist.org/packages/samsara/fermat).

### Modules

Modules for Fermat provide additional functionality, as many of these features would be unused by most people. **NOTE:** Prior to v2.0, much of this functionality was included in this package:

- [Algebra Expressions](https://github.com/SamsaraLabs/FermatAlgebraExpressions): Provides support for algebraic expressions such as polynomials and functions.
- [Complex Numbers](https://github.com/SamsaraLabs/FermatComplexNumbers): Provides complex numbers and enables additional features in Decimal instances.
- [Coordinate Systems](https://github.com/SamsaraLabs/FermatCoordinateSystems): Provides coordinate systems for cartesian, spherical, polar, and cylindrical coordinates.
- [Matrices & Vectors](https://github.com/SamsaraLabs/FermatMatricesAndVectors): Provides support for matrix math and vector math.
- [Statistics](https://github.com/SamsaraLabs/FermatStats): Provides support for statistical operations and distributions.

## Documentation

The `Samsara\Fermat\Numbers` factory class provides a way to use the Value classes in Fermat without being as specific as those classes may require. Consider the following code:
Expand Down Expand Up @@ -73,7 +83,7 @@ echo $oneQuarter->add($five); // Prints: "21/4"
// Calls getValue() on $five and instantiates a new ImmutableFraction
```

You can read the full documentation for Fermat [here](https://github.com/JordanRL/Fermat/wiki/01.-Introduction).
You can read the full documentation for Fermat [here](https://jordanrl.github.io/Fermat/).

## Contributing

Expand Down
27 changes: 23 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,36 @@
"type": "library",
"description": "A library providing math and statistics operations for numbers of arbitrary size.",
"keywords": ["math", "bigint", "large numbers", "numbers", "stats", "statistics", "gaussian", "poisson"],
"homepage": "https://jordanrl.github.io/Fermat/",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/JordanRL"
}
],
"support": {
"issues": "https://github.com/JordanRL/Fermat/issues",
"docs": "https://jordanrl.github.io/Fermat/",
"source": "https://github.com/JordanRL/Fermat"
},
"authors": [
{
"name": "Jordan LeDoux",
"homepage": "https://github.com/JordanRL",
"role": "Developer"
}
],
"license": "GPL-2.0-or-later",
"require": {
"ircmaxell/random-lib": "^1.1",
"riimu/kit-baseconversion": "^1",
"samsara/common": "^1",
"php-ds/php-ds": "^1.1",
"php": ">=7.3.0",
"ext-bcmath": "*"
"php": ">=8.0"
},
"require-dev": {
"phpunit/phpunit": "9.*"
"phpunit/phpunit": "9.*",
"php-ds/php-ds": "^1.1",
"scrutinizer/ocular": "*"
},
"suggest": {
"ext-gmp": "*",
Expand Down
65 changes: 23 additions & 42 deletions docs/getting-started/direct-instantiation.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,33 +11,23 @@ These classes extend the `Decimal` abstract class, which comes with the followin

### Interfaces

--8<-- "has-interface/hashable.md"

--8<-- "has-interface/base-conversion.md"

--8<-- "has-interface/number.md"

--8<-- "has-interface/simple-number.md"

--8<-- "has-interface/decimal.md"
- `NumberInterface`
- `BaseConversionInterface`
- `SimpleNumberInterface`
- `DecimalInterface`

### Traits

--8<-- "uses-trait/arithmeticsimple.md"

--8<-- "uses-trait/comparison.md"

--8<-- "uses-trait/integer-math.md"

--8<-- "uses-trait/trigonometry.md"

--8<-- "uses-trait/inverse-trigonometry.md"

--8<-- "uses-trait/log.md"

--8<-- "uses-trait/scale.md"

### Constructor
- `ArithmeticSimpleTrait`
- `ArithmeticSelectionTrait`
- `ArithmeticScaleTrait`
- `ArithmeticNativeTrait`
- `ComparisonTrait`
- `IntegerMathTrait`
- `TrigonometryTrait`
- `InverseTrigonometryTrait`
- `LogTrait`
- `ScaleTrait`

!!! signature "__construct(mixed $value, int $scale = 10, int $base = 10)"
$value
Expand Down Expand Up @@ -81,23 +71,18 @@ These classes extend the `Fraction` abstract class, which comes with the followi

### Interfaces

--8<-- "has-interface/hashable.md"

--8<-- "has-interface/base-conversion.md"

--8<-- "has-interface/number.md"

--8<-- "has-interface/simple-number.md"

--8<-- "has-interface/fraction.md"
- `NumberInterface`
- `BaseConversionInterface`
- `SimpleNumberInterface`
- `FractionInterface`

### Traits

--8<-- "uses-trait/arithmeticsimple.md"

--8<-- "uses-trait/comparison.md"

### Constructor
- `ArithmeticSimpleTrait`
- `ArithmeticSelectionTrait`
- `ArithmeticScaleTrait`
- `ArithmeticNativeTrait`
- `ComparisonTrait`

!!! signature "__construct(mixed $numerator, mixed $denominator, $base = 10)"
$numerator
Expand Down Expand Up @@ -147,8 +132,6 @@ Used to represent complex number values. Either part can be an instance of `Frac

--8<-- "uses-trait/arithmeticcomplex.md"

### Constructor

!!! signature "__construct(mixed $realPart, mixed $imaginaryPart, ?int $scale = null, int $base = 10)"
$realPart
: The value of the real part; can be an instance of **FractionInterface**, and instance of **DecimalInterface**, or a scalar using the same restrictions as **Decimal**
Expand Down Expand Up @@ -181,8 +164,6 @@ Used to represent mathematical matrices and perform matrix math.

### Traits

### Constructor

!!! signature "__construct(array $data, string $mode = Matrix::MODE_ROWS_INPUT)"
$data
: An array of **NumberCollection**s, defining either the rows or the columns of the matrix; see below for more detailed information
Expand Down
80 changes: 39 additions & 41 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,43 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>

<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="tests/bootstrap.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="true"
stopOnFailure="false"
beStrictAboutOutputDuringTests="true"
timeoutForSmallTests="2"
timeoutForMediumTests="15"
timeoutForLargeTests="60">

<testsuites>
<testsuite name="Providers">
<directory suffix=".php">./tests/Samsara/Fermat/Provider</directory>
</testsuite>
<testsuite name="Types">
<directory suffix=".php">./tests/Samsara/Fermat/Types</directory>
</testsuite>
<testsuite name="Values">
<directory suffix=".php">./tests/Samsara/Fermat/Values</directory>
</testsuite>
<testsuite name="Factories">
<file>tests/Samsara/Fermat/MatricesTest.php</file>
<file>tests/Samsara/Fermat/NumbersTest.php</file>
</testsuite>
</testsuites>

<filter>
<whitelist>
<directory suffix=".php">./src/Samsara/Fermat</directory>
</whitelist>
</filter>

<logging>
<log type="coverage-clover" target="build/logs/coverage.clover" />
</logging>

<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
backupGlobals="false"
backupStaticAttributes="false"
bootstrap="tests/bootstrap.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="true"
stopOnFailure="false"
beStrictAboutOutputDuringTests="true"
timeoutForSmallTests="2"
timeoutForMediumTests="15"
timeoutForLargeTests="60"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage>
<include>
<directory suffix=".php">./src/Samsara/Fermat</directory>
</include>
<report>
<clover outputFile="build/logs/coverage.clover"/>
</report>
</coverage>
<testsuites>
<testsuite name="Providers">
<directory suffix=".php">./tests/Samsara/Fermat/Provider</directory>
</testsuite>
<testsuite name="Types">
<directory suffix=".php">./tests/Samsara/Fermat/Types</directory>
</testsuite>
<testsuite name="Values">
<directory suffix=".php">./tests/Samsara/Fermat/Values</directory>
</testsuite>
<testsuite name="Factories">
<file>tests/Samsara/Fermat/NumbersTest.php</file>
</testsuite>
</testsuites>
<logging/>
</phpunit>

0 comments on commit 893faab

Please sign in to comment.