<commit_before>/**
 * Created by sebb on 11/16/15.
 */
public class Uebung6 {

    // Aufgabe 1 (Platzhalter)
    public static double PiAnnaeherung(int rechtecke)
    {
        return 0;
    }

    // Aufgabe 2 a
    public static int round(double in)
    {
        int num = (int)in;
        return (in - num) < 0.5 ? num : ++num;
    }

    // Aufgabe 2 b
    public static double round(double in, int precision)
    {
        in *= pow(10, precision);

        return ((long)in) / (double)pow(10, precision);
    }

    // Helfer zu 2b
    public static int pow(int base, int exp)
    {
        int res = 1;

        for (int i = 0; i < exp; i++)
            res *= base;

        return res;
    }
<commit_msg>Uebung 6 A1<commit_after>/**
 * Created by sebb on 11/16/15.
 */
public class Uebung6 {

    // Aufgabe 1
    public static double PiAnnaeherung(int rechtecke)
    {
        if(rechtecke <1)
            return -1;
        else if(rechtecke == 1)
            return 1;

        double fl = 0, x = (1./rechtecke); // fläche

        for (int i = 1; i <= rechtecke; i++)
            fl += x * Math.sqrt(1 - pow(i*x, 2));

        return (4*fl);
    }

    // Aufgabe 2 a
    public static int round(double in)
    {
        int num = (int)in;
        return (in - num) < 0.5 ? num : ++num;
    }

    // Aufgabe 2 b
    public static double round(double in, int precision)
    {
        return ((long)pow(10, precision)) / pow(10, precision);
    }

    // Helfer zu 2b
    public static double pow(double base, int exp)
    {
        double res = 1;

        for (int i = 0; i < exp; i++)
            res *= base;

        return res;
    }

{'fraction_non_alphanumeric': 0.1275695284159613, 'fraction_numerical': 0.03083434099153567, 'mean_word_length': 1.5859375, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, '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': '2528331', 'n_tokens_mistral': 616, 'n_tokens_neox': 564, 'n_words': 180}