diff --git a/package-lock.json b/package-lock.json index 1c7da86..0572fd5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@influenceth/sdk", - "version": "2.3.0", + "version": "2.3.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@influenceth/sdk", - "version": "2.3.0", + "version": "2.3.1", "license": "SEE LICENSE IN LICENSE", "dependencies": { "@influenceth/astro": "^0.2.6", diff --git a/package.json b/package.json index 652d8e6..162d692 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@influenceth/sdk", - "version": "2.3.0", + "version": "2.3.1", "description": "Influence SDK", "type": "module", "module": "./build/index.js", diff --git a/src/utils/simplex.js b/src/utils/simplex.js index 2b84ed4..d74cd6f 100644 --- a/src/utils/simplex.js +++ b/src/utils/simplex.js @@ -384,7 +384,7 @@ export const percentileByOctaves = (noise, octaves) => { const raws = SIMPLEX_OCTAVES[octaves].find((b) => BigInt(Math.round(noiseArg * 2 ** 32)) < b[0]); const [ limit, whole, low, high ] = raws.map((n) => Number(n) / 2 ** 32); - if (whole === 0 && noiseArg <= low) return 0; + if (whole === 0 && noiseArg <= low) noiseArg = low; const partial = (noiseArg - low) / (100 * (high - low)); const percentile = whole + partial; diff --git a/test/lib/asteroid.spec.js b/test/lib/asteroid.spec.js index e24910f..39b6bc6 100644 --- a/test/lib/asteroid.spec.js +++ b/test/lib/asteroid.spec.js @@ -165,6 +165,10 @@ describe('Asteroid library', function () { abundances = 163694267033613831154047584829516n; abundance = asteroid.getAbundanceAtLot(1, 1758637, 7, abundances); expect(Number(abundance.toFixed(4))).to.equal(0.9338); + + abundances = 15330960757084393714262110814936014964360621324743354563n; + abundance = asteroid.getAbundanceAtLot(5394, 14, 5, abundances); + expect(Number(abundance.toFixed(5))).to.equal(1); }); it('should get abundances at a unit sphere position', function () {