Comparing version 1.0.9 to 1.0.10
@@ -73,4 +73,4 @@ // FRACTY CONVERTS DECIMAL NUMBERS TO FRACTIONS BY ASSUMING THAT TRAILING PATTERNS FROM 10^-2 CONTINUE TO REPEAT | ||
if (pattern && decimal.length > 2) { //In keeping with the most standard numbering conventions of monetary divisibility, etc., if there's a pattern beyond two decimal places, reverse back the pattern that the greedy regex deemed a single unit, and the full pattern sequence, respectively. | ||
patternSequence = pattern[0].split('').reverse().join(''); | ||
endPattern = pattern[1].split('').reverse().join(''); | ||
let patternSequence = pattern[0].split('').reverse().join(''); | ||
let endPattern = pattern[1].split('').reverse().join(''); | ||
@@ -80,3 +80,3 @@ if (endPattern.length > 1) { //Test to see if the pattern unit is actually a single repeating digit. | ||
let testSingleUnit = 1; | ||
for (i = 0; i < endPatternArray.length; i++) { | ||
for (let i = 0; i < endPatternArray.length; i++) { | ||
testSingleUnit /= endPatternArray[0]/endPatternArray[i]; | ||
@@ -126,3 +126,3 @@ } | ||
if (rep === true) { //If the numerator is from a repeating decimal case, fracty generates an array of prime numbers from 2 to the square root of the numerator, loops over the array to find the common denominators, and reduces the fraction. Since reducing by prime numbers beyond i^2 isn't necessary, fracty creates and array of the prime numbers that, when squared, are still less than or equal to the numerator. | ||
for (i = 3; i * i <= numerator; i+=2) { | ||
for (let i = 3; i * i <= numerator; i+=2) { | ||
if (numerator % i === 0) { | ||
@@ -129,0 +129,0 @@ primeNumberArray.push(i); |
{ | ||
"name": "fracty", | ||
"version": "1.0.9", | ||
"version": "1.0.10", | ||
"description": "Fracty is a decimal-to-fraction conversion module that solves the many well known problems with decimal-to-fraction conversion modules. Those common problems include overlooking conversion inaccuracies in the IEEE Standard for Floating-Point Arithmetic (IEEE 754), mishandling numbers with trailing repeat patterns, and incorrect or partial pattern recognition. Fracty simply takes one argument, a number without any rounding and, in keeping with the most standard numbering conventions of monetary divisibility, etc., imagines that any trailing repeating patterns beyond two decimal places continue infinitely, and returns that input as a string of the fully reduced fraction equivalent.", | ||
@@ -5,0 +5,0 @@ "main": "fracty.js", |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
18980
0