Skip to content

Commit

Permalink
Merge pull request #7 from JordanRL/dev
Browse files Browse the repository at this point in the history
Prepare for v1.0.0 release
  • Loading branch information
JordanRL committed Jan 16, 2017
2 parents 4b95cd5 + f560a08 commit 504c228
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 19 deletions.
45 changes: 33 additions & 12 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,36 @@ This project adheres to [Semantic Versioning](http://semver.org/). At least so m

## [Unreleased] - [unreleased]
### Added
- **Dependencies:**
- riimu/kit-baseconversion: v1.*
- ircmaxell/random-lib: v1.1.*
- php-ds/php-ds: v1.1.*
- ext-bcmath: *
- **Suggested Extensions**
- ext-ds: *
- ext-stats: * (NOTE: This extension can't be used because it is not available for PHP 7+)
- ext-gmp: *
- **Dev Dependencies:**
- phpunit/phpunit: v4.8.*

*Nothing*

### Removed

*Nothing*

### Changed

*Nothing*

### Fixed

*Nothing*

## [v1.0.0] - 2017-01-15
### Added
- Composer
- **Dependencies:**
- riimu/kit-baseconversion: v1.*
- ircmaxell/random-lib: v1.1.*
- php-ds/php-ds: v1.1.*
- samsara/common: dev-master
- ext-bcmath: *
- **Dev Dependencies:**
- phpunit/phpunit: v5.7.*
- **Suggested:**
- ext-ds: *
- ext-stats: * (NOTE: This extension can't be used because it is not available for PHP 7+)
- ext-gmp: *
- Types:
- Interfaces:
- CoordinateInterface
Expand All @@ -40,4 +59,6 @@ This project adheres to [Semantic Versioning](http://semver.org/). At least so m
- SequenceProvider
- SeriesProvider
- StatsProvider
- TrigonometryProvider
- TrigonometryProvider

[unreleased]: https://github.com/JordanRL/Fermat/compare/v1.0.0...HEAD
19 changes: 12 additions & 7 deletions src/Samsara/Fermat/Numbers.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,16 @@ public static function make($type, $value, $precision = null, $base = 10)
} elseif ($type == static::MUTABLE) {
return new MutableNumber(trim($value), $precision, $base);
} elseif ($type == static::IMMUTABLE_FRACTION) {
return self::makeFractionFromString($value, $type)->convertToBase($base);
return self::makeFractionFromString($type, $value, $base);
} elseif ($type == static::MUTABLE_FRACTION) {
return self::makeFractionFromString($value, $type)->convertToBase($base);
return self::makeFractionFromString($type, $value, $base);
} elseif ($type == static::CARTESIAN_COORDINATE && is_array($value)) {
return new CartesianCoordinate($value);
} else {
$reflector = new \ReflectionClass($type);

if ($reflector->implementsInterface(FractionInterface::class) && $reflector->isSubclassOf(Fraction::class)) {
return Numbers::makeFractionFromString($value, $reflector->getName(), $base);
return Numbers::makeFractionFromString($reflector->getName(), $value, $base);
}

if ($reflector->implementsInterface(CoordinateInterface::class) && is_array($value)) {
Expand Down Expand Up @@ -160,13 +160,14 @@ public static function makeOrDont($type, $value, $precision = null, $base = 10)
}

/**
* @param $value
* @param $type
* @param $type
* @param $value
* @param int $base
*
* @return ImmutableFraction|MutableFraction|FractionInterface
* @return FractionInterface|ImmutableFraction|MutableFraction
* @throws IntegrityConstraint
*/
public static function makeFractionFromString($value, $type = self::IMMUTABLE_FRACTION, $base = 10)
public static function makeFractionFromString($type, $value, $base = 10)
{
$parts = explode('/', $value);

Expand Down Expand Up @@ -342,6 +343,8 @@ public static function makeNaturalLog10($precision = null)
}

/**
* @param int|null $precision
*
* @return ImmutableNumber
*/
public static function makeOne($precision = null)
Expand All @@ -350,6 +353,8 @@ public static function makeOne($precision = null)
}

/**
* @param int|null $precision
*
* @return ImmutableNumber
*/
public static function makeZero($precision = null)
Expand Down

0 comments on commit 504c228

Please sign in to comment.