Home
last modified time | relevance | path

Searched refs:Fraction (Results 1 – 25 of 71) sorted by relevance

123

/external/apache-commons-math/src/main/java/org/apache/commons/math/fraction/
DFraction.java37 public class Fraction class
39 implements FieldElement<Fraction>, Comparable<Fraction>, Serializable {
42 public static final Fraction TWO = new Fraction(2, 1);
45 public static final Fraction ONE = new Fraction(1, 1);
48 public static final Fraction ZERO = new Fraction(0, 1);
51 public static final Fraction FOUR_FIFTHS = new Fraction(4, 5);
54 public static final Fraction ONE_FIFTH = new Fraction(1, 5);
57 public static final Fraction ONE_HALF = new Fraction(1, 2);
60 public static final Fraction ONE_QUARTER = new Fraction(1, 4);
63 public static final Fraction ONE_THIRD = new Fraction(1, 3);
[all …]
DFractionFormat.java86 public static String formatFraction(Fraction f) { in formatFraction()
144 public StringBuffer format(final Fraction fraction, in format()
176 if (obj instanceof Fraction) { in format()
177 ret = format((Fraction) obj, toAppendTo, pos); in format()
180 ret = format(new Fraction(((Number) obj).doubleValue()), in format()
203 public Fraction parse(final String source) throws ParseException { in parse()
205 final Fraction result = parse(source, parsePosition); in parse()
222 public Fraction parse(final String source, final ParsePosition pos) { in parse()
245 return new Fraction(num.intValue(), 1); in parse()
271 return new Fraction(num.intValue(), den.intValue()); in parse()
DFractionField.java33 public class FractionField implements Field<Fraction>, Serializable {
51 public Fraction getOne() { in getOne()
52 return Fraction.ONE; in getOne()
56 public Fraction getZero() { in getZero()
57 return Fraction.ZERO; in getZero()
DProperFractionFormat.java90 public StringBuffer format(Fraction fraction, StringBuffer toAppendTo, in format()
135 public Fraction parse(String source, ParsePosition pos) { in parse()
137 Fraction ret = super.parse(source, pos); in parse()
183 return new Fraction(num.intValue(), 1); in parse()
218 return new Fraction(((Math.abs(w) * d) + n) * MathUtils.sign(w), d); in parse()
/external/python/cpython2/Doc/library/
Dfractions.rst17 A Fraction instance can be constructed from a pair of integers, from
20 .. class:: Fraction(numerator=0, denominator=1)
21 Fraction(other_fraction)
22 Fraction(float)
23 Fraction(decimal)
24 Fraction(string)
27 of :class:`numbers.Rational` and returns a new :class:`Fraction` instance
31 :class:`Fraction` instance with the same value. The next two versions accept
33 :class:`Fraction` instance with exactly the same value. Note that due to the
35 argument to ``Fraction(1.1)`` is not exactly equal to 11/10, and so
[all …]
Dnumbers.rst87 extensions of the real numbers. For example, :class:`fractions.Fraction`
182 :class:`fractions.Fraction` uses::
186 if isinstance(b, (int, long, Fraction)):
214 return Fraction(a.numerator * b.denominator +
/external/python/cpython3/Doc/library/
Dfractions.rst17 A Fraction instance can be constructed from a pair of integers, from
20 .. class:: Fraction(numerator=0, denominator=1)
21 Fraction(other_fraction)
22 Fraction(float)
23 Fraction(decimal)
24 Fraction(string)
27 of :class:`numbers.Rational` and returns a new :class:`Fraction` instance
31 :class:`Fraction` instance with the same value. The next two versions accept
33 :class:`Fraction` instance with exactly the same value. Note that due to the
35 argument to ``Fraction(1.1)`` is not exactly equal to 11/10, and so
[all …]
Dstatistics.rst27 :class:`float`, :class:`decimal.Decimal` and :class:`fractions.Fraction`.
90 >>> from fractions import Fraction as F
92 Fraction(13, 21)
354 >>> from fractions import Fraction as F
356 Fraction(13, 72)
420 Decimal and Fraction values are supported:
428 >>> from fractions import Fraction as F
430 Fraction(67, 108)
Dnumbers.rst88 extensions of the real numbers. For example, :class:`fractions.Fraction`
185 :class:`fractions.Fraction` uses::
189 if isinstance(b, (int, Fraction)):
217 return Fraction(a.numerator * b.denominator +
/external/python/cpython2/Lib/
Dfractions.py44 class Fraction(Rational): class
99 self = super(Fraction, cls).__new__(cls)
109 value = Fraction.from_float(numerator)
115 value = Fraction.from_decimal(numerator)
241 return Fraction(self)
254 bound1 = Fraction(p0+k*p1, q0+k*q1)
255 bound2 = Fraction(p1, q1)
361 if isinstance(b, (int, long, Fraction)):
389 return Fraction(a.numerator * b.denominator +
397 return Fraction(a.numerator * b.denominator -
[all …]
/external/python/cpython3/Lib/
Dfractions.py60 class Fraction(numbers.Rational): class
115 self = super(Fraction, cls).__new__(cls)
254 return Fraction(self)
267 bound1 = Fraction(p0+k*p1, q0+k*q1)
268 bound2 = Fraction(p1, q1)
375 if isinstance(b, (int, Fraction)):
404 return Fraction(a.numerator * db + b.numerator * da,
412 return Fraction(a.numerator * db - b.numerator * da,
419 return Fraction(a.numerator * b.numerator, a.denominator * b.denominator)
425 return Fraction(a.numerator * b.denominator,
[all …]
Dstatistics.py89 from fractions import Fraction
158 total = sum(Fraction(n, d) for d, n in sorted(partials.items()))
191 if issubclass(T, Fraction) and issubclass(S, float):
193 if issubclass(T, float) and issubclass(S, Fraction):
/external/python/cpython3/Lib/test/
Dtest_statistics.py16 from fractions import Fraction
295 args1 = [2456, 37.8, -12.45, Decimal('2.54'), Fraction(17, 54)]
296 args2 = [2459, 37.2, -12.41, Decimal('2.59'), Fraction(15, 54)]
318 for type_ in (int, float, Decimal, Fraction):
368 F = Fraction
386 f = Fraction(n, 1234)
396 for x in [8347, 101.3, -7910.28, Fraction(5, 21)]:
402 for x in [41017, 16.742, -813.02, Fraction(3, 8)]:
429 F = Fraction
467 delta = Fraction(1, 29)
[all …]
Dtest_random.py11 from fractions import Fraction
196 … [Fraction(1, 3), Fraction(2, 6), Fraction(3, 6), Fraction(4, 6)], # fractional weights
212 … [Fraction(1, 3), Fraction(2, 6), Fraction(3, 6), Fraction(4, 6)], # fractional cum_weights
Dtest_math.py1005 from fractions import Fraction
1012 fx, fy, fr = Fraction(x), Fraction(y), Fraction(r)
1538 from fractions import Fraction
1541 (Fraction(1, 100000000) + 1, Fraction(1)),
1542 (Fraction(100000001), Fraction(100000000)),
1543 (Fraction(10**8 + 1, 10**28), Fraction(1, 10**20))]
Dtest_itertools.py6 from fractions import Fraction
127 for typ in int, complex, Decimal, Fraction: # multiple types
534 self.assertEqual(take(3, count(Fraction(2, 3))),
535 [Fraction(2, 3), Fraction(5, 3), Fraction(8, 3)])
584 self.assertEqual(take(3, count(Fraction(2,3), Fraction(1,7))),
585 [Fraction(2,3), Fraction(17,21), Fraction(20,21)])
/external/swiftshader/third_party/llvm-7.0/llvm/lib/Transforms/Utils/
DImportedFunctionsInliningStatistics.cpp71 static std::string getStatString(const char *Msg, int32_t Fraction, int32_t All, in getStatString() argument
76 Result = 100 * static_cast<double>(Fraction) / All; in getStatString()
79 Str << std::setprecision(4) << Msg << ": " << Fraction << " [" << Result in getStatString()
/external/apache-commons-math/src/main/java/org/apache/commons/math/linear/
DMatrixUtils.java32 import org.apache.commons.math.fraction.Fraction;
664 public static Array2DRowRealMatrix fractionMatrixToRealMatrix(final FieldMatrix<Fraction> m) { in fractionMatrixToRealMatrix()
671 …rivate static class FractionMatrixConverter extends DefaultFieldMatrixPreservingVisitor<Fraction> {
678 super(Fraction.ZERO); in FractionMatrixConverter()
690 public void visit(int row, int column, Fraction value) { in visit()
/external/webrtc/webrtc/video/
Dsend_statistics_proxy.cc421 return Fraction(min_required_samples, 100.0f); in Percent()
426 return Fraction(min_required_samples, 1000.0f); in Permille()
429 int SendStatisticsProxy::BoolSampleCounter::Fraction( in Fraction() function in webrtc::SendStatisticsProxy::BoolSampleCounter
Dsend_statistics_proxy.h119 int Fraction(int min_required_samples, float multiplier) const;
/external/fonttools/Tests/misc/
Dpy23_test.py385 from fractions import Fraction
388 fraction_examples = [(Fraction(1, 100000000) + 1, Fraction(1))]
/external/python/cpython3/Doc/whatsnew/
D3.1.rst268 sequence including :class:`fractions.Fraction` and
277 >>> c = count(start=Fraction(1,2), step=Fraction(1,6))
279 [Fraction(1, 2), Fraction(2, 3), Fraction(5, 6), Fraction(1, 1)]
/external/python/cpython2/Lib/test/
Dtest_itertools.py6 from fractions import Fraction
360 self.assertEqual(take(3, count(Fraction(2, 3))),
361 [Fraction(2, 3), Fraction(5, 3), Fraction(8, 3)])
409 self.assertEqual(take(3, count(Fraction(2,3), Fraction(1,7))),
410 [Fraction(2,3), Fraction(17,21), Fraction(20,21)])
Dtest_fractions.py13 F = fractions.Fraction
65 if isinstance(other, fractions.Fraction):
92 class DummyFraction(fractions.Fraction):
/external/python/cpython3/Doc/tutorial/
Dfloatingpoint.rst288 >>> from fractions import Fraction
290 >>> Fraction.from_float(0.1)
291 Fraction(3602879701896397, 36028797018963968)

123