Home
last modified time | relevance | path

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

1234

/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/llvm-project/mlir/include/mlir/Analysis/Presburger/
DFraction.h26 struct Fraction { struct
28 Fraction() : num(0), den(1) {} in Fraction() argument
31 Fraction(int64_t oNum, int64_t oDen) : num(oNum), den(oDen) { in Fraction() function
46 inline int compare(Fraction x, Fraction y) { in compare() argument
55 inline int64_t floor(Fraction f) { return floorDiv(f.num, f.den); } in floor()
57 inline int64_t ceil(Fraction f) { return ceilDiv(f.num, f.den); } in ceil()
59 inline Fraction operator-(Fraction x) { return Fraction(-x.num, x.den); }
61 inline bool operator<(Fraction x, Fraction y) { return compare(x, y) < 0; }
63 inline bool operator<=(Fraction x, Fraction y) { return compare(x, y) <= 0; }
65 inline bool operator==(Fraction x, Fraction y) { return compare(x, y) == 0; }
[all …]
DSimplex.h180 Optional<Fraction> computeRowOptimum(Direction direction, unsigned row);
187 Optional<Fraction> computeOptimum(Direction direction,
/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 …]
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/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/Lib/
Dfractions.py38 class Fraction(numbers.Rational): class
93 self = super(Fraction, cls).__new__(cls)
236 return Fraction(self)
249 bound1 = Fraction(p0+k*p1, q0+k*q1)
250 bound2 = Fraction(p1, q1)
357 if isinstance(b, (int, Fraction)):
386 return Fraction(a.numerator * db + b.numerator * da,
394 return Fraction(a.numerator * db - b.numerator * da,
401 return Fraction(a.numerator * b.numerator, a.denominator * b.denominator)
407 return Fraction(a.numerator * b.denominator,
[all …]
Dstatistics.py107 from fractions import Fraction
177 total = sum(Fraction(n, d) for d, n in sorted(partials.items()))
210 if issubclass(T, Fraction) and issubclass(S, float):
212 if issubclass(T, float) and issubclass(S, Fraction):
/external/llvm-project/flang/include/flang/Evaluate/
Dreal.h52 using Fraction = Integer<binaryPrecision>; // all bits made explicit variable
136 false, exponentBias - binaryPrecision, Fraction::MASKL(1)); in EPSILON()
141 huge.Normalize(false, maxExponent - 1, Fraction::MASKR(binaryPrecision)); in HUGE()
146 tiny.Normalize(false, 1, Fraction::MASKL(1)); // minimum *normal* number in TINY()
197 Fraction fraction{Fraction::ConvertUnsigned(absN).value};
201 Fraction fraction{Fraction::ConvertUnsigned(absN.SHIFTR(bitsLost)).value};
267 typename A::Fraction xFraction{x.GetFraction()};
269 Fraction fraction{
270 Fraction::ConvertUnsigned(xFraction).value.SHIFTL(-bitsLost)};
273 Fraction fraction{
[all …]
/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/webrtc/media/base/
Dvideo_adapter.cc28 struct Fraction { struct
56 Fraction FindScale(int input_width, in FindScale()
70 return Fraction{1, 1}; in FindScale()
72 Fraction current_scale = Fraction{1, 1}; in FindScale()
73 Fraction best_scale = Fraction{1, 1}; in FindScale()
79 current_scale = Fraction{6, 6}; in FindScale()
83 current_scale = Fraction{36, 36}; in FindScale()
250 const Fraction scale = in AdaptFrameResolution()
/external/python/cpython3/Lib/test/
Dtest_statistics.py20 from fractions import Fraction
317 args1 = [2456, 37.8, -12.45, Decimal('2.54'), Fraction(17, 54)]
318 args2 = [2459, 37.2, -12.41, Decimal('2.59'), Fraction(15, 54)]
340 for type_ in (int, float, Decimal, Fraction):
390 F = Fraction
408 f = Fraction(n, 1234)
418 for x in [8347, 101.3, -7910.28, Fraction(5, 21)]:
424 for x in [41017, 16.742, -813.02, Fraction(3, 8)]:
451 F = Fraction
489 delta = Fraction(1, 29)
[all …]
Dtest_random.py13 from fractions import Fraction
280 … [Fraction(1, 3), Fraction(2, 6), Fraction(3, 6), Fraction(4, 6)], # fractional weights
296 … [Fraction(1, 3), Fraction(2, 6), Fraction(3, 6), Fraction(4, 6)], # fractional cum_weights
Dtest_math.py738 from fractions import Fraction
755 self.assertEqual(hypot(Fraction(12, 32), Fraction(5, 32)), Fraction(13, 32))
812 from fractions import Fraction as F
1291 from fractions import Fraction
1298 fx, fy, fr = Fraction(x), Fraction(y), Fraction(r)
2139 from fractions import Fraction
2142 (Fraction(1, 100000000) + 1, Fraction(1)),
2143 (Fraction(100000001), Fraction(100000000)),
2144 (Fraction(10**8 + 1, 10**28), Fraction(1, 10**20))]
/external/llvm-project/mlir/lib/Analysis/Presburger/
DSimplex.cpp464 Optional<Fraction> Simplex::computeRowOptimum(Direction direction, in computeRowOptimum()
478 return Fraction(tableau(row, 1), tableau(row, 0)); in computeRowOptimum()
483 Optional<Fraction> Simplex::computeOptimum(Direction direction, in computeOptimum()
490 Optional<Fraction> optimum = computeRowOptimum(direction, row); in computeOptimum()
542 Optional<Fraction> minimum = computeRowOptimum(Direction::Down, row); in detectRedundant()
543 if (!minimum || *minimum < Fraction(0, 1)) { in detectRedundant()
562 Optional<Fraction> maybeMax = computeOptimum(Direction::Up, dir); in isUnbounded()
566 Optional<Fraction> maybeMin = computeOptimum(Direction::Down, dir); in isUnbounded()
711 Fraction computeWidthAndDuals(ArrayRef<int64_t> dir, in computeWidthAndDuals()
717 Optional<Fraction> maybeWidth = in computeWidthAndDuals()
[all …]
/external/llvm-project/flang/lib/Evaluate/
Dreal.cpp109 Fraction fraction{GetFraction()}; in Add()
110 Fraction yFraction{y.GetFraction()}; in Add()
228 Fraction top{GetFraction()}, divisor{y.GetFraction()}; in Divide()
230 Fraction quotient; in Divide()
277 adjust.Normalize(IsSignBitSet(), noClipExponent, Fraction::MASKL(1)); in ToWholeNumber()
292 const Fraction &fraction, Rounding rounding, RoundingBits *roundingBits) { in Normalize()
361 typename Fraction::ValueWithCarry sum{ in Round()
362 GetFraction().AddUnsigned(Fraction{}, true)}; in Round()
393 bool isNegative, int exponent, const Fraction &fraction, Rounding rounding, in NormalizeAndRound()
450 Fraction frac{GetFraction()}; in DumpHexadecimal()
/external/llvm-project/llvm/lib/Transforms/Utils/
DImportedFunctionsInliningStatistics.cpp70 static std::string getStatString(const char *Msg, int32_t Fraction, int32_t All, in getStatString() argument
75 Result = 100 * static_cast<double>(Fraction) / All; in getStatString()
78 Str << std::setprecision(4) << Msg << ": " << Fraction << " [" << Result in getStatString()
/external/swiftshader/third_party/llvm-10.0/llvm/lib/Transforms/Utils/
DImportedFunctionsInliningStatistics.cpp70 static std::string getStatString(const char *Msg, int32_t Fraction, int32_t All, in getStatString() argument
75 Result = 100 * static_cast<double>(Fraction) / All; in getStatString()
78 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/fonttools/Tests/misc/
Dpy23_test.py385 from fractions import Fraction
388 fraction_examples = [(Fraction(1, 100000000) + 1, Fraction(1))]
/external/rust/crates/grpcio-sys/grpc/src/proto/grpc/testing/xds/v3/
Dpercent.proto28 // Fraction percentages support several fixed denominator values.

1234