Mercurial > hg > gc-bench
changeset 72:f321fbdd1093
Sequence.
author | shade |
---|---|
date | Wed, 26 Apr 2017 20:35:23 +0200 |
parents | 95129eeb5f7a |
children | a2da92eb9aa9 |
files | src/main/java/org/openjdk/gcbench/tests/Sequence.java |
diffstat | 1 files changed, 24 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/org/openjdk/gcbench/tests/Sequence.java Wed Mar 15 22:00:03 2017 +0100 +++ b/src/main/java/org/openjdk/gcbench/tests/Sequence.java Wed Apr 26 20:35:23 2017 +0200 @@ -24,6 +24,30 @@ return new Sequence("[" + min + ", " + max + "], power-of-ten steps, last step divided in 5 parts", vs); } + public static Sequence powersOfTen_Sub10(int min, int max) { + List<Object> vs = new ArrayList<>(); + for (int v = min; v <= max; v *= 10) { + for (int t = 1; t < 10; t++) { + int n = v * t; + if (n <= max) { + vs.add(n); + } + } + } + return new Sequence("[" + min + ", " + max + "], power-of-ten steps, last step divided in 10 parts", vs); + } + + public static Sequence equidistantLog(int min, int max, int steps) { + List<Object> vs = new ArrayList<>(); + double minLog = Math.log(min); + double maxLog = Math.log(max); + for (int c = 0; c <= steps; c++) { + double v = minLog + (maxLog - minLog) * c / steps; + vs.add((int)Math.exp(v)); + } + return new Sequence("[" + min + ", " + max + "], equidistant, " + steps + " steps", vs); + } + public static Sequence powersOfTen(int min, int max) { List<Object> vs = new ArrayList<>(); for (int v = min; v <= max; v *= 10) {