Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.poi.ss.format
Class SimpleFraction

    java.lang.Object
      org.apache.poi.ss.format.SimpleFraction

    public class SimpleFraction

extends java.lang.Object

Constructor Summary
`SimpleFraction(int numerator, int denominator)` Create a fraction given a numerator and denominator.

Method Summary
`static SimpleFraction` | `buildFractionExactDenominator(double val, int exactDenom)` Create a fraction given a double value and a denominator.
`static SimpleFraction` | `buildFractionMaxDenominator(double value, int maxDenominator)` Create a fraction given the double value and either the maximum error allowed or the maximum number of denominator digits.
`int` | `getDenominator()` Access the denominator.
`int` | `getNumerator()` Access the numerator.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### SimpleFraction

    public SimpleFraction(int numerator,
                          int denominator)

  Create a fraction given a numerator and denominator.

  Parameters:
    `numerator` -
    `denominator` - maxDenominator The maximum allowed value for denominator

Method Detail

### buildFractionExactDenominator

    public static SimpleFraction buildFractionExactDenominator(double val,
                                                               int exactDenom)

  Create a fraction given a double value and a denominator.

  Parameters:
    `val` - double value of fraction
    `exactDenom` - the exact denominator
  Returns:
    a SimpleFraction with the given values set.

### buildFractionMaxDenominator

    public static SimpleFraction buildFractionMaxDenominator(double value,
                                                             int maxDenominator)

  Create a fraction given the double value and either the maximum error allowed or the maximum number of denominator digits.

  Parameters:
    `value` - the double value to convert to a fraction.
    `maxDenominator` - maximum denominator value allowed.
  Throws:
    `java.lang.RuntimeException` - if the continued fraction failed to converge.
    `java.lang.IllegalArgumentException` - if value > Integer.MAX_VALUE

### getDenominator

    public int getDenominator()

  Access the denominator.

  Returns:
    the denominator.

### getNumerator

    public int getNumerator()

  Access the numerator.

  Returns:
    the numerator.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright 2017 The Apache Software Foundation or its licensors, as applicable.