10
0
mirror of https://github.com/LCPQ/QUESTDB_website.git synced 2024-11-03 20:53:59 +01:00

Fix a bug when all values are NaN

This commit is contained in:
Mickaël Véril 2019-11-21 09:55:21 +01:00
parent dff320c005
commit c874f0095b

View File

@ -146,7 +146,7 @@ draft: false
} }
$(row).append(td) $(row).append(td)
} }
const noNanVals = vals.filter((v) => !Number.isNaN(v)) const noNanVals=(vals.every((v)=> Number.isNaN(v)))? vals : (vals.filter((v) => !Number.isNaN(v)))
const avals = noNanVals.map(v => Math.abs(v)) const avals = noNanVals.map(v => Math.abs(v))
for (const val of [ss.min(noNanVals), ss.max(noNanVals), ss.mean(noNanVals), ss.mean(avals), ss.median(noNanVals), ss.median(avals), ss.rootMeanSquare(noNanVals), ss.variance(noNanVals), ss.standardDeviation(noNanVals)]) { for (const val of [ss.min(noNanVals), ss.max(noNanVals), ss.mean(noNanVals), ss.mean(avals), ss.median(noNanVals), ss.median(avals), ss.rootMeanSquare(noNanVals), ss.variance(noNanVals), ss.standardDeviation(noNanVals)]) {
$("<td/>").text(noNanPrecision(val, 3)).appendTo(row) $("<td/>").text(noNanPrecision(val, 3)).appendTo(row)