Groophy.Math.Math.per(new GValue("64"), Math.pers.percent);
-> %64
percent - 100
per_mille - 1000
per_million - 1000000
per_billion - 1000000000
per_trillion - 1000000000000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | /// <summary> /// https://groophy-inc.github.io/root /// percent - 100 /// per_mille - 1000 /// per_million - 1000000 /// per_billion - 1000000000 /// per_trillion - 1000000000000 /// </summary> public enum pers { percent, per_mille, per_million, per_billion, per_trillion } /// <summary> /// https://groophy-inc.github.io/per /// </summary> /// <param name="value"></param> /// <param name="p"></param> /// <returns></returns> public static GValue per(GValue value, pers p) { switch (p) { case pers.percent: return Math.Division(value, new GValue("1")); break; case pers.per_mille: return Math.Division(value, new GValue("10")); break; case pers.per_million: return Math.Division(value, new GValue("10000")); break; case pers.per_billion: return Math.Division(value, new GValue("10000000")); break; case pers.per_trillion: return Math.Division(value, new GValue("10000000000")); break; } return new GValue("0"); } |
Copyright © Groophy.Inc ' Batch-Man