import java.math.BigInteger;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        double K = (double)sc.nextInt();

        sc.close();

        Fraction sum = new Fraction(0, 1);

        for(int i=1; i<=N; i++){
            int denominator = N;
            if(i < K){
                denominator *= (int)(Math.pow(2, Math.ceil(Math.log(K/i) / Math.log(2))));
            }
            //int denominator = (int)(Math.pow(2, Math.ceil(Math.log(K/i) / Math.log(2))) * N);
            System.err.println(denominator); //#############
            if (denominator == 0) continue;
            Fraction tmp = new Fraction(1, denominator);
            sum.addition(tmp);
        }

        System.err.println(sum.getNumerator());//#############
        System.err.println(sum.getDenominator());//#############
        double result = sum.getNumerator().doubleValue() / sum.getDenominator().doubleValue();
        System.out.println(result);
    }
}

//コピペ
// https://gist.github.com/namiken/363bc136d7a2f1809d6b
/**
 * 分数の値、および計算メソッドを保持するクラス。計算メソッドを利用すると自信の分数の値が書き換わる。(引数の値は書き換わりません)
 *
 */
class Fraction {
    /**
     *  分子
     */
    private BigInteger numerator;

    /**
     *  分母
     */
    private BigInteger denominator;

    /**分数を作る
     * @param numerator 分子
     * @param denominator 分母
     */
    public Fraction(int numerator, int denominator) {
        //分母がゼロならエラー
        if (denominator == 0) {
            throw new RuntimeException("denominator is not permission 'zero'");
        }
        this.numerator = BigInteger.valueOf(numerator);
        this.denominator = BigInteger.valueOf(denominator);

        reduction();
    }

    /**
     * 約分を行う
     */
    private void reduction() {
        BigInteger gcdi = gcdi(numerator, denominator);
        numerator = numerator.divide(gcdi);
        denominator = denominator.divide(gcdi);
    }

    /**
     * 引数の分数を加える
     * @param fraction
     * @return
     */
    public void addition(Fraction fraction) {
        numerator =  fraction.denominator.multiply(numerator).add(fraction.numerator.multiply(denominator));
        denominator = denominator.multiply(fraction.denominator);

        reduction();
    }

    /**
     * 引数の分数を引く
     * @param fraction 引かれる数
     * @return
     */
    public void subtraction(Fraction fraction) {
        numerator = fraction.denominator.multiply(numerator).subtract(fraction.numerator.multiply(denominator));
        denominator = denominator.multiply(fraction.denominator);

        reduction();
    }

    /**
     * 引数の分数を掛ける
     * @param fraction
     * @return
     */
    public void multiplication(Fraction fraction) {
        denominator = denominator.multiply(fraction.denominator);
        numerator = numerator.multiply(fraction.numerator);

        reduction();
    }

    /**
     * 引数の分数を割る
     * @param fraction 割られる数
     * @return
     */
    public void division(Fraction fraction) {
        denominator = denominator.multiply(fraction.numerator);
        numerator = numerator.multiply(fraction.denominator);

        reduction();
    }

    /**
     * 分子を返す
     * @return
     */
    public BigInteger getNumerator() {
        return numerator;
    }

    /**
     * 分母を返す
     * @return
     */
    public BigInteger getDenominator() {
        return denominator;
    }

    @Override
    public String toString() {
        //分母が1のときは分子だけ返す
        if (denominator == BigInteger.ONE) {
            return numerator.toString();
        }
        return numerator + "/" + denominator;
    }

    /**
     * 最大公約数を求める
     * @param a
     * @param b
     * @return
     */
    private static BigInteger gcdi(BigInteger a, BigInteger b) {
        BigInteger gcd = a.gcd(b);
        //int result = gcd.intValue();
        //System.err.println("GCD:" + result);
        return gcd;
    }
} import java.math.BigInteger; BigInteger java.math import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        double K = (double)sc.nextInt();

        sc.close();

        Fraction sum = new Fraction(0, 1);

        for(int i=1; i<=N; i++){
            int denominator = N;
            if(i < K){
                denominator *= (int)(Math.pow(2, Math.ceil(Math.log(K/i) / Math.log(2))));
            }
            //int denominator = (int)(Math.pow(2, Math.ceil(Math.log(K/i) / Math.log(2))) * N);
            System.err.println(denominator); //#############
            if (denominator == 0) continue;
            Fraction tmp = new Fraction(1, denominator);
            sum.addition(tmp);
        }

        System.err.println(sum.getNumerator());//#############
        System.err.println(sum.getDenominator());//#############
        double result = sum.getNumerator().doubleValue() / sum.getDenominator().doubleValue();
        System.out.println(result);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        double K = (double)sc.nextInt();

        sc.close();

        Fraction sum = new Fraction(0, 1);

        for(int i=1; i<=N; i++){
            int denominator = N;
            if(i < K){
                denominator *= (int)(Math.pow(2, Math.ceil(Math.log(K/i) / Math.log(2))));
            }
            //int denominator = (int)(Math.pow(2, Math.ceil(Math.log(K/i) / Math.log(2))) * N);
            System.err.println(denominator); //#############
            if (denominator == 0) continue;
            Fraction tmp = new Fraction(1, denominator);
            sum.addition(tmp);
        }

        System.err.println(sum.getNumerator());//#############
        System.err.println(sum.getDenominator());//#############
        double result = sum.getNumerator().doubleValue() / sum.getDenominator().doubleValue();
        System.out.println(result);
    } main {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        double K = (double)sc.nextInt();

        sc.close();

        Fraction sum = new Fraction(0, 1);

        for(int i=1; i<=N; i++){
            int denominator = N;
            if(i < K){
                denominator *= (int)(Math.pow(2, Math.ceil(Math.log(K/i) / Math.log(2))));
            }
            //int denominator = (int)(Math.pow(2, Math.ceil(Math.log(K/i) / Math.log(2))) * N);
            System.err.println(denominator); //#############
            if (denominator == 0) continue;
            Fraction tmp = new Fraction(1, denominator);
            sum.addition(tmp);
        }

        System.err.println(sum.getNumerator());//#############
        System.err.println(sum.getDenominator());//#############
        double result = sum.getNumerator().doubleValue() / sum.getDenominator().doubleValue();
        System.out.println(result);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc double K = (double)sc.nextInt(); K (double)sc.nextInt() sc.nextInt sc sc.close() sc.close sc Fraction sum = new Fraction(0, 1); sum new Fraction(0, 1) for(int i=1; i<=N; i++){
            int denominator = N;
            if(i < K){
                denominator *= (int)(Math.pow(2, Math.ceil(Math.log(K/i) / Math.log(2))));
            }
            //int denominator = (int)(Math.pow(2, Math.ceil(Math.log(K/i) / Math.log(2))) * N);
            System.err.println(denominator); //#############
            if (denominator == 0) continue;
            Fraction tmp = new Fraction(1, denominator);
            sum.addition(tmp);
        } int i=1; int i=1; i 1 i<=N i N i++ i++ i {
            int denominator = N;
            if(i < K){
                denominator *= (int)(Math.pow(2, Math.ceil(Math.log(K/i) / Math.log(2))));
            }
            //int denominator = (int)(Math.pow(2, Math.ceil(Math.log(K/i) / Math.log(2))) * N);
            System.err.println(denominator); //#############
            if (denominator == 0) continue;
            Fraction tmp = new Fraction(1, denominator);
            sum.addition(tmp);
        } {
            int denominator = N;
            if(i < K){
                denominator *= (int)(Math.pow(2, Math.ceil(Math.log(K/i) / Math.log(2))));
            }
            //int denominator = (int)(Math.pow(2, Math.ceil(Math.log(K/i) / Math.log(2))) * N);
            System.err.println(denominator); //#############
            if (denominator == 0) continue;
            Fraction tmp = new Fraction(1, denominator);
            sum.addition(tmp);
        } int denominator = N; denominator N if(i < K){
                denominator *= (int)(Math.pow(2, Math.ceil(Math.log(K/i) / Math.log(2))));
            } i < K i K {
                denominator *= (int)(Math.pow(2, Math.ceil(Math.log(K/i) / Math.log(2))));
            } denominator *= (int)(Math.pow(2, Math.ceil(Math.log(K/i) / Math.log(2)))) denominator (int)(Math.pow(2, Math.ceil(Math.log(K/i) / Math.log(2)))) Math.pow Math 2 Math.ceil(Math.log(K/i) / Math.log(2)) Math.ceil Math Math.log(K/i) / Math.log(2) Math.log(K/i) Math.log Math K/i K i Math.log(2) Math.log Math 2 System.err.println(denominator) System.err.println System.err System System.err denominator if (denominator == 0) continue; denominator == 0 denominator 0 continue; Fraction tmp = new Fraction(1, denominator); tmp new Fraction(1, denominator) sum.addition(tmp) sum.addition sum tmp System.err.println(sum.getNumerator()) System.err.println System.err System System.err sum.getNumerator() sum.getNumerator sum System.err.println(sum.getDenominator()) System.err.println System.err System System.err sum.getDenominator() sum.getDenominator sum double result = sum.getNumerator().doubleValue() / sum.getDenominator().doubleValue(); result sum.getNumerator().doubleValue() / sum.getDenominator().doubleValue() sum.getNumerator().doubleValue() sum.getNumerator().doubleValue sum.getNumerator() sum.getNumerator sum sum.getDenominator().doubleValue() sum.getDenominator().doubleValue sum.getDenominator() sum.getDenominator sum System.out.println(result) System.out.println System.out System System.out result String[] args args class Fraction {
    /**
     *  分子
     */
    private BigInteger numerator;

    /**
     *  分母
     */
    private BigInteger denominator;

    /**分数を作る
     * @param numerator 分子
     * @param denominator 分母
     */
    public Fraction(int numerator, int denominator) {
        //分母がゼロならエラー
        if (denominator == 0) {
            throw new RuntimeException("denominator is not permission 'zero'");
        }
        this.numerator = BigInteger.valueOf(numerator);
        this.denominator = BigInteger.valueOf(denominator);

        reduction();
    }

    /**
     * 約分を行う
     */
    private void reduction() {
        BigInteger gcdi = gcdi(numerator, denominator);
        numerator = numerator.divide(gcdi);
        denominator = denominator.divide(gcdi);
    }

    /**
     * 引数の分数を加える
     * @param fraction
     * @return
     */
    public void addition(Fraction fraction) {
        numerator =  fraction.denominator.multiply(numerator).add(fraction.numerator.multiply(denominator));
        denominator = denominator.multiply(fraction.denominator);

        reduction();
    }

    /**
     * 引数の分数を引く
     * @param fraction 引かれる数
     * @return
     */
    public void subtraction(Fraction fraction) {
        numerator = fraction.denominator.multiply(numerator).subtract(fraction.numerator.multiply(denominator));
        denominator = denominator.multiply(fraction.denominator);

        reduction();
    }

    /**
     * 引数の分数を掛ける
     * @param fraction
     * @return
     */
    public void multiplication(Fraction fraction) {
        denominator = denominator.multiply(fraction.denominator);
        numerator = numerator.multiply(fraction.numerator);

        reduction();
    }

    /**
     * 引数の分数を割る
     * @param fraction 割られる数
     * @return
     */
    public void division(Fraction fraction) {
        denominator = denominator.multiply(fraction.numerator);
        numerator = numerator.multiply(fraction.denominator);

        reduction();
    }

    /**
     * 分子を返す
     * @return
     */
    public BigInteger getNumerator() {
        return numerator;
    }

    /**
     * 分母を返す
     * @return
     */
    public BigInteger getDenominator() {
        return denominator;
    }

    @Override
    public String toString() {
        //分母が1のときは分子だけ返す
        if (denominator == BigInteger.ONE) {
            return numerator.toString();
        }
        return numerator + "/" + denominator;
    }

    /**
     * 最大公約数を求める
     * @param a
     * @param b
     * @return
     */
    private static BigInteger gcdi(BigInteger a, BigInteger b) {
        BigInteger gcd = a.gcd(b);
        //int result = gcd.intValue();
        //System.err.println("GCD:" + result);
        return gcd;
    }
} Fraction /**
     *  分子
     */
    private BigInteger numerator; numerator /**
     *  分母
     */
    private BigInteger denominator; denominator /**分数を作る
     * @param numerator 分子
     * @param denominator 分母
     */
    public Fraction(int numerator, int denominator) {
        //分母がゼロならエラー
        if (denominator == 0) {
            throw new RuntimeException("denominator is not permission 'zero'");
        }
        this.numerator = BigInteger.valueOf(numerator);
        this.denominator = BigInteger.valueOf(denominator);

        reduction();
    } Fraction {
        //分母がゼロならエラー
        if (denominator == 0) {
            throw new RuntimeException("denominator is not permission 'zero'");
        }
        this.numerator = BigInteger.valueOf(numerator);
        this.denominator = BigInteger.valueOf(denominator);

        reduction();
    } if (denominator == 0) {
            throw new RuntimeException("denominator is not permission 'zero'");
        } denominator == 0 denominator 0 {
            throw new RuntimeException("denominator is not permission 'zero'");
        } throw new RuntimeException("denominator is not permission 'zero'"); new RuntimeException("denominator is not permission 'zero'") this.numerator = BigInteger.valueOf(numerator) this.numerator this this.numerator BigInteger.valueOf(numerator) BigInteger.valueOf BigInteger numerator this.denominator = BigInteger.valueOf(denominator) this.denominator this this.denominator BigInteger.valueOf(denominator) BigInteger.valueOf BigInteger denominator reduction() reduction int numerator numerator int denominator denominator /**
     * 約分を行う
     */
    private void reduction() {
        BigInteger gcdi = gcdi(numerator, denominator);
        numerator = numerator.divide(gcdi);
        denominator = denominator.divide(gcdi);
    } reduction {
        BigInteger gcdi = gcdi(numerator, denominator);
        numerator = numerator.divide(gcdi);
        denominator = denominator.divide(gcdi);
    } BigInteger gcdi = gcdi(numerator, denominator); gcdi gcdi(numerator, denominator) gcdi numerator denominator numerator = numerator.divide(gcdi) numerator numerator.divide(gcdi) numerator.divide numerator gcdi denominator = denominator.divide(gcdi) denominator denominator.divide(gcdi) denominator.divide denominator gcdi /**
     * 引数の分数を加える
     * @param fraction
     * @return
     */
    public void addition(Fraction fraction) {
        numerator =  fraction.denominator.multiply(numerator).add(fraction.numerator.multiply(denominator));
        denominator = denominator.multiply(fraction.denominator);

        reduction();
    } addition {
        numerator =  fraction.denominator.multiply(numerator).add(fraction.numerator.multiply(denominator));
        denominator = denominator.multiply(fraction.denominator);

        reduction();
    } numerator =  fraction.denominator.multiply(numerator).add(fraction.numerator.multiply(denominator)) numerator fraction.denominator.multiply(numerator).add(fraction.numerator.multiply(denominator)) fraction.denominator.multiply(numerator).add fraction.denominator.multiply(numerator) fraction.denominator.multiply fraction.denominator fraction fraction.denominator numerator fraction.numerator.multiply(denominator) fraction.numerator.multiply fraction.numerator fraction fraction.numerator denominator denominator = denominator.multiply(fraction.denominator) denominator denominator.multiply(fraction.denominator) denominator.multiply denominator fraction.denominator fraction fraction.denominator reduction() reduction Fraction fraction fraction /**
     * 引数の分数を引く
     * @param fraction 引かれる数
     * @return
     */
    public void subtraction(Fraction fraction) {
        numerator = fraction.denominator.multiply(numerator).subtract(fraction.numerator.multiply(denominator));
        denominator = denominator.multiply(fraction.denominator);

        reduction();
    } subtraction {
        numerator = fraction.denominator.multiply(numerator).subtract(fraction.numerator.multiply(denominator));
        denominator = denominator.multiply(fraction.denominator);

        reduction();
    } numerator = fraction.denominator.multiply(numerator).subtract(fraction.numerator.multiply(denominator)) numerator fraction.denominator.multiply(numerator).subtract(fraction.numerator.multiply(denominator)) fraction.denominator.multiply(numerator).subtract fraction.denominator.multiply(numerator) fraction.denominator.multiply fraction.denominator fraction fraction.denominator numerator fraction.numerator.multiply(denominator) fraction.numerator.multiply fraction.numerator fraction fraction.numerator denominator denominator = denominator.multiply(fraction.denominator) denominator denominator.multiply(fraction.denominator) denominator.multiply denominator fraction.denominator fraction fraction.denominator reduction() reduction Fraction fraction fraction /**
     * 引数の分数を掛ける
     * @param fraction
     * @return
     */
    public void multiplication(Fraction fraction) {
        denominator = denominator.multiply(fraction.denominator);
        numerator = numerator.multiply(fraction.numerator);

        reduction();
    } multiplication {
        denominator = denominator.multiply(fraction.denominator);
        numerator = numerator.multiply(fraction.numerator);

        reduction();
    } denominator = denominator.multiply(fraction.denominator) denominator denominator.multiply(fraction.denominator) denominator.multiply denominator fraction.denominator fraction fraction.denominator numerator = numerator.multiply(fraction.numerator) numerator numerator.multiply(fraction.numerator) numerator.multiply numerator fraction.numerator fraction fraction.numerator reduction() reduction Fraction fraction fraction /**
     * 引数の分数を割る
     * @param fraction 割られる数
     * @return
     */
    public void division(Fraction fraction) {
        denominator = denominator.multiply(fraction.numerator);
        numerator = numerator.multiply(fraction.denominator);

        reduction();
    } division {
        denominator = denominator.multiply(fraction.numerator);
        numerator = numerator.multiply(fraction.denominator);

        reduction();
    } denominator = denominator.multiply(fraction.numerator) denominator denominator.multiply(fraction.numerator) denominator.multiply denominator fraction.numerator fraction fraction.numerator numerator = numerator.multiply(fraction.denominator) numerator numerator.multiply(fraction.denominator) numerator.multiply numerator fraction.denominator fraction fraction.denominator reduction() reduction Fraction fraction fraction /**
     * 分子を返す
     * @return
     */
    public BigInteger getNumerator() {
        return numerator;
    } getNumerator {
        return numerator;
    } return numerator; numerator /**
     * 分母を返す
     * @return
     */
    public BigInteger getDenominator() {
        return denominator;
    } getDenominator {
        return denominator;
    } return denominator; denominator @Override
    public String toString() {
        //分母が1のときは分子だけ返す
        if (denominator == BigInteger.ONE) {
            return numerator.toString();
        }
        return numerator + "/" + denominator;
    } toString {
        //分母が1のときは分子だけ返す
        if (denominator == BigInteger.ONE) {
            return numerator.toString();
        }
        return numerator + "/" + denominator;
    } if (denominator == BigInteger.ONE) {
            return numerator.toString();
        } denominator == BigInteger.ONE denominator BigInteger.ONE BigInteger BigInteger.ONE {
            return numerator.toString();
        } return numerator.toString(); numerator.toString() numerator.toString numerator return numerator + "/" + denominator; numerator + "/" + denominator numerator + "/" + denominator numerator "/" denominator /**
     * 最大公約数を求める
     * @param a
     * @param b
     * @return
     */
    private static BigInteger gcdi(BigInteger a, BigInteger b) {
        BigInteger gcd = a.gcd(b);
        //int result = gcd.intValue();
        //System.err.println("GCD:" + result);
        return gcd;
    } gcdi {
        BigInteger gcd = a.gcd(b);
        //int result = gcd.intValue();
        //System.err.println("GCD:" + result);
        return gcd;
    } BigInteger gcd = a.gcd(b); gcd a.gcd(b) a.gcd a b return gcd; gcd BigInteger a a BigInteger b b public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        double K = (double)sc.nextInt();

        sc.close();

        Fraction sum = new Fraction(0, 1);

        for(int i=1; i<=N; i++){
            int denominator = N;
            if(i < K){
                denominator *= (int)(Math.pow(2, Math.ceil(Math.log(K/i) / Math.log(2))));
            }
            //int denominator = (int)(Math.pow(2, Math.ceil(Math.log(K/i) / Math.log(2))) * N);
            System.err.println(denominator); //#############
            if (denominator == 0) continue;
            Fraction tmp = new Fraction(1, denominator);
            sum.addition(tmp);
        }

        System.err.println(sum.getNumerator());//#############
        System.err.println(sum.getDenominator());//#############
        double result = sum.getNumerator().doubleValue() / sum.getDenominator().doubleValue();
        System.out.println(result);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        double K = (double)sc.nextInt();

        sc.close();

        Fraction sum = new Fraction(0, 1);

        for(int i=1; i<=N; i++){
            int denominator = N;
            if(i < K){
                denominator *= (int)(Math.pow(2, Math.ceil(Math.log(K/i) / Math.log(2))));
            }
            //int denominator = (int)(Math.pow(2, Math.ceil(Math.log(K/i) / Math.log(2))) * N);
            System.err.println(denominator); //#############
            if (denominator == 0) continue;
            Fraction tmp = new Fraction(1, denominator);
            sum.addition(tmp);
        }

        System.err.println(sum.getNumerator());//#############
        System.err.println(sum.getDenominator());//#############
        double result = sum.getNumerator().doubleValue() / sum.getDenominator().doubleValue();
        System.out.println(result);
    }
} Main
import java.math.BigInteger;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        double K = (double)sc.nextInt();

        sc.close();

        Fraction sum = new Fraction(0, 1);

        for(int i=1; i<=N; i++){
            int denominator = N;
            if(i < K){
                denominator *= (int)(Math.pow(2, Math.ceil(Math.log(K/i) / Math.log(2))));
            }
            //int denominator = (int)(Math.pow(2, Math.ceil(Math.log(K/i) / Math.log(2))) * N);
            System.err.println(denominator); //#############
            if (denominator == 0) continue;
            Fraction tmp = new Fraction(1, denominator);
            sum.addition(tmp);
        }

        System.err.println(sum.getNumerator());//#############
        System.err.println(sum.getDenominator());//#############
        double result = sum.getNumerator().doubleValue() / sum.getDenominator().doubleValue();
        System.out.println(result);
    }
}

//コピペ
// https://gist.github.com/namiken/363bc136d7a2f1809d6b
/**
 * 分数の値、および計算メソッドを保持するクラス。計算メソッドを利用すると自信の分数の値が書き換わる。(引数の値は書き換わりません)
 *
 */
class Fraction {
    /**
     *  分子
     */
    private BigInteger numerator;

    /**
     *  分母
     */
    private BigInteger denominator;

    /**分数を作る
     * @param numerator 分子
     * @param denominator 分母
     */
    public Fraction(int numerator, int denominator) {
        //分母がゼロならエラー
        if (denominator == 0) {
            throw new RuntimeException("denominator is not permission 'zero'");
        }
        this.numerator = BigInteger.valueOf(numerator);
        this.denominator = BigInteger.valueOf(denominator);

        reduction();
    }

    /**
     * 約分を行う
     */
    private void reduction() {
        BigInteger gcdi = gcdi(numerator, denominator);
        numerator = numerator.divide(gcdi);
        denominator = denominator.divide(gcdi);
    }

    /**
     * 引数の分数を加える
     * @param fraction
     * @return
     */
    public void addition(Fraction fraction) {
        numerator =  fraction.denominator.multiply(numerator).add(fraction.numerator.multiply(denominator));
        denominator = denominator.multiply(fraction.denominator);

        reduction();
    }

    /**
     * 引数の分数を引く
     * @param fraction 引かれる数
     * @return
     */
    public void subtraction(Fraction fraction) {
        numerator = fraction.denominator.multiply(numerator).subtract(fraction.numerator.multiply(denominator));
        denominator = denominator.multiply(fraction.denominator);

        reduction();
    }

    /**
     * 引数の分数を掛ける
     * @param fraction
     * @return
     */
    public void multiplication(Fraction fraction) {
        denominator = denominator.multiply(fraction.denominator);
        numerator = numerator.multiply(fraction.numerator);

        reduction();
    }

    /**
     * 引数の分数を割る
     * @param fraction 割られる数
     * @return
     */
    public void division(Fraction fraction) {
        denominator = denominator.multiply(fraction.numerator);
        numerator = numerator.multiply(fraction.denominator);

        reduction();
    }

    /**
     * 分子を返す
     * @return
     */
    public BigInteger getNumerator() {
        return numerator;
    }

    /**
     * 分母を返す
     * @return
     */
    public BigInteger getDenominator() {
        return denominator;
    }

    @Override
    public String toString() {
        //分母が1のときは分子だけ返す
        if (denominator == BigInteger.ONE) {
            return numerator.toString();
        }
        return numerator + "/" + denominator;
    }

    /**
     * 最大公約数を求める
     * @param a
     * @param b
     * @return
     */
    private static BigInteger gcdi(BigInteger a, BigInteger b) {
        BigInteger gcd = a.gcd(b);
        //int result = gcd.intValue();
        //System.err.println("GCD:" + result);
        return gcd;
    }
}