Skip to content
This repository was archived by the owner on Jun 2, 2025. It is now read-only.

Commit ac84948

Browse files
committed
🐛 Fixing little bug with float in predict
1 parent a8108e1 commit ac84948

5 files changed

Lines changed: 8 additions & 5 deletions

File tree

__test__/display.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,7 @@ class DisplayJS {
676676
const math = this.math;
677677
const djs = this;
678678
const X = Object.keys(array)
679-
for(var i=0; i<X.length;i++) X[i] = parseInt(X[i]);
679+
for(var i=0; i<X.length;i++) X[i] = parseFloat(X[i]);
680680
const Y = Object.values(array)
681681
const N = X.length // could also be Y.length
682682
let XY = [];

__test__/dom.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,10 @@
4040
djs.append(a, "Hello")
4141
})
4242

43-
djs.text(djs.select(".predict"),djs.predict([[1,5],[2,18]], 4, true))
43+
djs.text(djs.select(".predict"),djs.predict({
44+
1: 5,
45+
2: 18,
46+
}, 4, true))
4447
djs.css(".bg", {
4548
"background": "blue"
4649
})

dist/display.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -721,7 +721,7 @@ class DisplayJS {
721721
const math = this.math;
722722
const djs = this;
723723
const X = Object.keys(array);
724-
for (var i = 0; i < X.length; i++) X[i] = parseInt(X[i]);
724+
for (var i = 0; i < X.length; i++) X[i] = parseFloat(X[i]);
725725
const Y = Object.values(array);
726726
const N = X.length; // could also be Y.length
727727
let XY = [];

dist/display.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/includes/math.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ predict(array, val, text=false) {
8080
const math = this.math;
8181
const djs = this;
8282
const X = Object.keys(array)
83-
for(var i=0; i<X.length;i++) X[i] = parseInt(X[i]);
83+
for(var i=0; i<X.length;i++) X[i] = parseFloat(X[i]);
8484
const Y = Object.values(array)
8585
const N = X.length // could also be Y.length
8686
let XY = [];

0 commit comments

Comments
 (0)