Skip to content

Commit

Permalink
Merge pull request #315 from 06wj/patch0
Browse files Browse the repository at this point in the history
Fix expect.toBeEqualish and vec4.random bug
  • Loading branch information
stefnotch authored May 28, 2018
2 parents 11f01b6 + 9b70a7d commit f1871a7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion spec/helpers/spec-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,12 @@ global.expect = function(e) {
*/
toBeEqualish: function(a) {

if (typeof(e) == 'number')
if (typeof(e) == 'number') {
if(isNaN(e) !== isNaN(a))
expected(e, "to be equalish to", a);
if(Math.abs(e - a) >= EPSILON)
expected(e, "to be equalish to", a);
}

if (e.length != a.length)
assert.fail(e.length, a.length, "length mismatch");
Expand Down
4 changes: 2 additions & 2 deletions src/gl-matrix/vec4.js
Original file line number Diff line number Diff line change
Expand Up @@ -409,8 +409,8 @@ export function lerp(out, a, b, t) {
* @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned
* @returns {vec4} out
*/
export function random(out, vectorScale) {
vectorScale = vectorScale || 1.0;
export function random(out, scale) {
scale = scale || 1.0;

// Marsaglia, George. Choosing a Point from the Surface of a
// Sphere. Ann. Math. Statist. 43 (1972), no. 2, 645--646.
Expand Down

0 comments on commit f1871a7

Please sign in to comment.