X-Git-Url: http://git.euphorik.ch/?p=master-thesis.git;a=blobdiff_plain;f=Parasitemia%2FParasitemiaUI%2FUtils.fs;h=9f51436dc1d93d9ce41a50e006c0a8506f5f4a1d;hp=e7c9784cced1e103c63495825e0988933cccb119;hb=2f335ec0c462159ed9f424e3793b7af290404062;hpb=c3f9ff71e0f80120b1f5b3e84e028b02b8cb1541 diff --git a/Parasitemia/ParasitemiaUI/Utils.fs b/Parasitemia/ParasitemiaUI/Utils.fs index e7c9784..9f51436 100644 --- a/Parasitemia/ParasitemiaUI/Utils.fs +++ b/Parasitemia/ParasitemiaUI/Utils.fs @@ -61,6 +61,38 @@ let sensorSizes : SensorSize list = saveSensorSizesToFile defaultSensorSizes defaultSensorSizes +let toRomanNumber (v : int) : string = + let rec decompose (v : int) : string = + if v >= 1000 then + "M" + decompose (v - 1000) + elif v >= 900 then + "CM" + decompose (v - 900) + elif v >= 500 then + "D" + decompose (v - 500) + elif v >= 400 then + "CD" + decompose (v - 400) + elif v >= 100 then + "C" + decompose (v - 100) + elif v >= 90 then + "XC" + decompose (v - 90) + elif v >= 50 then + "L" + decompose (v - 50) + elif v >= 40 then + "XL" + decompose (v - 40) + elif v >= 10 then + "X" + decompose (v - 10) + elif v >= 9 then + "IX" + decompose (v - 9) + elif v >= 5 then + "V" + decompose (v - 5) + elif v >= 4 then + "IV" + decompose (v - 4) + elif v >= 1 then + "I" + decompose (v - 1) + else + "" + decompose v + let argsHelp = let programName = System.AppDomain.CurrentDomain.FriendlyName "Usage of Parasitemia:\n" +