Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
variety
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fact-gitdep
variety
Commits
01e6f3da
Commit
01e6f3da
authored
Mar 19, 2015
by
Tomas Dvorak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
significant digits count fix
parent
ef763c8d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
4 deletions
+3
-4
variety.js
variety.js
+3
-4
No files found.
variety.js
View file @
01e6f3da
...
...
@@ -275,11 +275,10 @@ if($outputFormat === 'json') {
}
else
{
// output nice ascii table with results
var
table
=
[[
'key'
,
'types'
,
'occurrences'
,
'percents'
],
[
''
,
''
,
''
,
''
]];
// header + delimiter rows
// return the number of decimal places or 1, if the number is int (1.23=>2, 100=>1, 0.1415=>4)
var
significantDigits
=
function
(
value
)
{
return
value
.
toExponential
()
.
replace
(
/e
[\+\-
0-9
]
*$/
,
''
)
// remove exponential notation
.
replace
(
/^0
\.?
0*|
\.
/
,
''
)
// remove decimal point and leading zeros
.
length
;
var
res
=
value
.
toString
().
match
(
/^
[
0-9
]
+
\.([
0-9
]
+
)
$/
);
return
res
!==
null
?
res
[
1
].
length
:
1
;
};
var
maxDigits
=
Math
.
max
.
apply
(
null
,
varietyResults
.
map
(
function
(
value
){
return
significantDigits
(
value
.
percentContaining
);}));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment