<commit_before>﻿using Esri;
using Esri.ArcGISRuntime.Geometry;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;

namespace System
{
    public class Utils
    {
        public static int SecDecPlaces = 2;

        private static string TextFilePaht = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), "Ellipsoidus.txt");

        public static void ShowNotepad(IEnumerable<string> lines)
        {
            File.WriteAllLines(Utils.TextFilePaht, lines.ToArray<string>());
            Process.Start(Utils.TextFilePaht);
        }

        public static void ShowNotepad(string text)
        {
            File.WriteAllText(Utils.TextFilePaht, text);
            Process.Start(Utils.TextFilePaht);
        }

        public static string ToDegMinSecString(double angle, int secDecPlaces)
        {
            var deg = Math.Floor(angle);

            angle = (angle - deg) * 60.0; // minutes
            var min = Math.Floor(angle);

            angle = (angle - min) * 60.0; // seconds
            var sec = Math.Round(angle, SecDecPlaces + 3, MidpointRounding.ToEven); // remove rounding precision noise  ("0.000": 36.032500000002443 -> 36.032500)
            sec = Math.Round(sec, secDecPlaces, MidpointRounding.ToEven);           // without above fix result will be 36.033 (valid result is 36.032)
<commit_msg>use rounding to even numbers<commit_after>﻿using Esri;
using Esri.ArcGISRuntime.Geometry;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;

namespace System
{
    public class Utils
    {
        public static int SecDecPlaces = 2;

        private static string TextFilePaht = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), "Ellipsoidus.txt");

        public static void ShowNotepad(IEnumerable<string> lines)
        {
            File.WriteAllLines(Utils.TextFilePaht, lines.ToArray<string>());
            Process.Start(Utils.TextFilePaht);
        }

        public static void ShowNotepad(string text)
        {
            File.WriteAllText(Utils.TextFilePaht, text);
            Process.Start(Utils.TextFilePaht);
        }

        public static string ToDegMinSecString(double angle, int secDecPlaces)
        {
            var deg = Math.Floor(angle);

            angle = (angle - deg) * 60.0; // minutes
            var min = Math.Floor(angle);

            angle = (angle - min) * 60.0; // seconds
            var sec = Math.Round(angle, SecDecPlaces + 3, MidpointRounding.ToEven); // remove rounding precision noise  ("0.000": 36.032500000002443 -> 36.032500)
            sec = Math.Round(sec, secDecPlaces, MidpointRounding.ToEven);           // without above fix result would be 36.033, but it should be 36.032

{'fraction_non_alphanumeric': 0.09869325997248968, 'fraction_numerical': 0.032324621733149934, 'mean_word_length': 2.6181592039800994, 'pattern_counts': {'":': 2, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7419827', 'n_tokens_mistral': 926, 'n_tokens_neox': 830, 'n_words': 207}