Home
last modified time | relevance | path

Searched refs:fraction (Results 1 – 25 of 349) sorted by relevance

12345678910>>...14

/external/python/cpython2/Lib/
Dfpformat.py43 sign, intpart, fraction, exppart = res.group(1,2,3,4)
46 if fraction: fraction = fraction[1:]
49 return sign, intpart, fraction, expo
51 def unexpo(intpart, fraction, expo): argument
54 f = len(fraction)
55 intpart, fraction = intpart + fraction[:expo], fraction[expo:]
60 intpart, fraction = intpart[:expo], intpart[expo:] + fraction
62 fraction = '0'*(-expo-i) + fraction
63 return intpart, fraction
65 def roundfrac(intpart, fraction, digs): argument
[all …]
/external/apache-commons-math/src/main/java/org/apache/commons/math/fraction/
DFraction.java17 package org.apache.commons.math.fraction;
430 public Fraction add(Fraction fraction) { in add() argument
431 return addSub(fraction, true /* add */); in add()
453 public Fraction subtract(Fraction fraction) { in subtract() argument
454 return addSub(fraction, false /* subtract */); in subtract()
476 private Fraction addSub(Fraction fraction, boolean isAdd) { in addSub() argument
477 if (fraction == null) { in addSub()
482 return isAdd ? fraction : fraction.negate(); in addSub()
484 if (fraction.numerator == 0) { in addSub()
489 int d1 = MathUtils.gcd(denominator, fraction.denominator); in addSub()
[all …]
DBigFraction.java17 package org.apache.commons.math.fraction;
505 public BigFraction add(final BigFraction fraction) { in add() argument
506 if (fraction == null) { in add()
509 if (ZERO.equals(fraction)) { in add()
516 if (denominator.equals(fraction.denominator)) { in add()
517 num = numerator.add(fraction.numerator); in add()
520 … num = (numerator.multiply(fraction.denominator)).add((fraction.numerator).multiply(denominator)); in add()
521 den = denominator.multiply(fraction.denominator); in add()
662 public BigFraction divide(final BigFraction fraction) { in divide() argument
663 if (fraction == null) { in divide()
[all …]
/external/apache-commons-lang/src/main/java/org/apache/commons/lang3/math/
DFraction.java268 double fraction; in getFraction() local
277 fraction = (double) numer2 / (double) denom2; in getFraction()
278 delta2 = Math.abs(value - fraction); in getFraction()
691 public Fraction add(final Fraction fraction) { in add() argument
692 return addSub(fraction, true /* add */); in add()
705 public Fraction subtract(final Fraction fraction) { in subtract() argument
706 return addSub(fraction, false /* subtract */); in subtract()
719 private Fraction addSub(final Fraction fraction, final boolean isAdd) { in addSub() argument
720 Objects.requireNonNull(fraction, "fraction"); in addSub()
723 return isAdd ? fraction : fraction.negate(); in addSub()
[all …]
/external/rust/crates/serde_json/src/lexical/
Dparse.rs38 let fraction = &[]; in parse_concise_float() localVariable
39 bhcomp(b, integer, fraction, mant_exp) in parse_concise_float()
49 pub fn parse_truncated_float<F>(integer: &[u8], mut fraction: &[u8], exponent: i32) -> F in parse_truncated_float()
54 while fraction.last() == Some(&b'0') { in parse_truncated_float()
55 fraction = &fraction[..fraction.len() - 1]; in parse_truncated_float()
61 let mut iter = integer.iter().chain(fraction); in parse_truncated_float()
72 let mant_exp = mantissa_exponent(exponent, fraction.len(), truncated); in parse_truncated_float()
77 fraction, in parse_truncated_float()
Dbhcomp.rs22 fn parse_mantissa<F>(integer: &[u8], fraction: &[u8]) -> Bigint in parse_mantissa()
36 for &digit in integer.iter().chain(fraction) { in parse_mantissa()
68 if i < integer.len() + fraction.len() { in parse_mantissa()
193 pub(crate) fn bhcomp<F>(b: F, integer: &[u8], mut fraction: &[u8], exponent: i32) -> F in bhcomp()
200 let fraction_digits = fraction.len(); in bhcomp()
202 let start = fraction.iter().take_while(|&x| *x == b'0').count(); in bhcomp()
203 fraction = &fraction[start..]; in bhcomp()
212 let mantissa = parse_mantissa::<F>(integer, fraction); in bhcomp()
/external/skia/tests/sksl/intrinsics/
DModf.glsl11 vec4 fraction;
12 fraction.x = modf(value.x, whole.x);
13 ok.x = whole.x == 2.0 && fraction.x == 0.5;
14 fraction.xy = modf(value.xy, whole.xy);
15 ok.y = whole.xy == vec2(2.0, -2.0) && fraction.xy == vec2(0.5, -0.5);
16 fraction.xyz = modf(value.xyz, whole.xyz);
17 ok.z = whole.xyz == vec3(2.0, -2.0, 8.0) && fraction.xyz == vec3(0.5, -0.5, 0.0);
18 fraction = modf(value, whole);
19 ok.w = whole == expectedWhole && fraction == expectedFraction;
DModf.metal45 float4 fraction;
46 fraction.x = _skOutParamHelper0_modf(value.x, whole);
47 ok.x = whole.x == 2.0 && fraction.x == 0.5;
48 fraction.xy = _skOutParamHelper1_modf(value.xy, whole);
49 ok.y = all(whole.xy == float2(2.0, -2.0)) && all(fraction.xy == float2(0.5, -0.5));
50 fraction.xyz = _skOutParamHelper2_modf(value.xyz, whole);
51 ok.z = all(whole.xyz == float3(2.0, -2.0, 8.0)) && all(fraction.xyz == float3(0.5, -0.5, 0.0));
52 fraction = _skOutParamHelper3_modf(value, whole);
53 ok.w = all(whole == expectedWhole) && all(fraction == expectedFraction);
DModf.asm.frag16 OpName %fraction "fraction"
95 %fraction = OpVariable %_ptr_Function_v4float Function
107 %47 = OpAccessChain %_ptr_Function_float %fraction %int_0
115 %54 = OpLoad %v4float %fraction
130 %68 = OpLoad %v4float %fraction
132 OpStore %fraction %69
154 %95 = OpLoad %v4float %fraction
156 OpStore %fraction %96
175 OpStore %fraction %111
/external/skia/resources/sksl/intrinsics/
DModf.sksl8 float4 whole, fraction;
10 fraction.x = modf(value.x, whole.x);
11 ok.x = whole.x == expectedWhole.x && fraction.x == expectedFraction.x;
12 fraction.xy = modf(value.xy, whole.xy);
13 ok.y = whole.xy == expectedWhole.xy && fraction.xy == expectedFraction.xy;
14 fraction.xyz = modf(value.xyz, whole.xyz);
15 ok.z = whole.xyz == expectedWhole.xyz && fraction.xyz == expectedFraction.xyz;
16 fraction.xyzw = modf(value.xyzw, whole.xyzw);
17 ok.w = whole.xyzw == expectedWhole.xyzw && fraction.xyzw == expectedFraction.xyzw;
/external/rust/crates/minimal-lexical/tests/
Dslow_tests.rs53 …let fraction = b"470328229206232720882843964341106861825299013071623822127928412503377536351043759… in slow_test() localVariable
63 let result = slow::slow::<f64, _, _>(num.clone(), fp, integer.iter(), fraction.iter()); in slow_test()
68 …let fraction = b"470328229206232720882843964341106861825299013071623822127928412503377536351043759… in slow_test() localVariable
69 let result = slow::slow::<f64, _, _>(num.clone(), fp, integer.iter(), fraction.iter()); in slow_test()
75 …let fraction = b"988465674311580536566680721305029496276241413130815897397134275615404541548669375… in slow_test() localVariable
85 let result = slow::slow::<f64, _, _>(num.clone(), fp, integer.iter(), fraction.iter()); in slow_test()
90 …let fraction = b"988465674311580536566680721305029496276241413130815897397134275615404541548669375… in slow_test() localVariable
91 let result = slow::slow::<f64, _, _>(num.clone(), fp, integer.iter(), fraction.iter()); in slow_test()
272 …let fraction = b"470328229206232720882843964341106861825299013071623822127928412503377536351043759… in parse_mantissa_test() localVariable
273 let (bigmant, count) = slow::parse_mantissa(integer.iter(), fraction.iter(), max_digits); in parse_mantissa_test()
[all …]
/external/deqp-deps/glslang/SPIRV/
Dhex_float.h672 uint_type fraction = static_cast<uint_type>((bits & HF::fraction_encode_mask)
675 const bool is_zero = exponent == 0 && fraction == 0;
689 while ((fraction & HF::fraction_top_bit) == 0) {
690 fraction = static_cast<uint_type>(fraction << 1);
695 fraction = static_cast<uint_type>(fraction << 1); // eat the leading 1
696 fraction &= HF::fraction_represent_mask;
702 while (fraction_nibbles > 0 && (fraction & 0xF) == 0) {
704 fraction = static_cast<uint_type>(fraction >> 4);
716 << std::setfill('0') << std::hex << fraction;
880 uint_type fraction = 0;
[all …]
/external/angle/third_party/vulkan-deps/glslang/src/SPIRV/
Dhex_float.h672 uint_type fraction = static_cast<uint_type>((bits & HF::fraction_encode_mask)
675 const bool is_zero = exponent == 0 && fraction == 0;
689 while ((fraction & HF::fraction_top_bit) == 0) {
690 fraction = static_cast<uint_type>(fraction << 1);
695 fraction = static_cast<uint_type>(fraction << 1); // eat the leading 1
696 fraction &= HF::fraction_represent_mask;
702 while (fraction_nibbles > 0 && (fraction & 0xF) == 0) {
704 fraction = static_cast<uint_type>(fraction >> 4);
716 << std::setfill('0') << std::hex << fraction;
880 uint_type fraction = 0;
[all …]
/external/tensorflow/tensorflow/lite/kernels/internal/
Dquantization_util.cc174 int64_t fraction = 0x40000000 + ((u & kFractionMask) >> kFractionShift); in IntegerFrExp() local
181 fraction += 1; in IntegerFrExp()
185 fraction *= -1; in IntegerFrExp()
188 return fraction; in IntegerFrExp()
191 double DoubleFromFractionAndShift(int64_t fraction, int shift) { in DoubleFromFractionAndShift() argument
199 if (fraction == 0) { in DoubleFromFractionAndShift()
201 } else if (fraction > 0) { in DoubleFromFractionAndShift()
209 if (fraction == 0) { in DoubleFromFractionAndShift()
214 bool is_negative = (fraction < 0); in DoubleFromFractionAndShift()
215 int64_t encoded_fraction = is_negative ? -fraction : fraction; in DoubleFromFractionAndShift()
[all …]
/external/rust/crates/minimal-lexical/src/
Dparse.rs23 fraction: Iter2, in parse_number_fast()
38 for &c in fraction { in parse_number_fast()
58 fn parse_number<'a, Iter1, Iter2>(mut integer: Iter1, mut fraction: Iter2, exponent: i32) -> Number in parse_number()
64 if let Some(num) = parse_number_fast(integer.clone(), fraction.clone(), exponent) { in parse_number()
88 for &c in &mut fraction { in parse_number()
98 for c in fraction { in parse_number()
146 pub fn parse_float<'a, F, Iter1, Iter2>(integer: Iter1, fraction: Iter2, exponent: i32) -> F in parse_float()
153 let num = parse_number(integer.clone(), fraction.clone(), exponent); in parse_float()
164 fp = slow::<F, _, _>(num, fp, integer, fraction); in parse_float()
/external/deqp-deps/SPIRV-Tools/source/util/
Dhex_float.h756 uint_type fraction = static_cast<uint_type>((bits & HF::fraction_encode_mask)
759 const bool is_zero = exponent == 0 && fraction == 0;
773 while ((fraction & HF::fraction_top_bit) == 0) {
774 fraction = static_cast<uint_type>(fraction << 1);
779 fraction = static_cast<uint_type>(fraction << 1); // eat the leading 1
780 fraction &= HF::fraction_represent_mask;
786 while (fraction_nibbles > 0 && (fraction & 0xF) == 0) {
788 fraction = static_cast<uint_type>(fraction >> 4);
800 << std::setfill('0') << std::hex << fraction;
965 uint_type fraction = 0;
[all …]
/external/swiftshader/third_party/SPIRV-Tools/source/util/
Dhex_float.h756 uint_type fraction = static_cast<uint_type>((bits & HF::fraction_encode_mask)
759 const bool is_zero = exponent == 0 && fraction == 0;
773 while ((fraction & HF::fraction_top_bit) == 0) {
774 fraction = static_cast<uint_type>(fraction << 1);
779 fraction = static_cast<uint_type>(fraction << 1); // eat the leading 1
780 fraction &= HF::fraction_represent_mask;
786 while (fraction_nibbles > 0 && (fraction & 0xF) == 0) {
788 fraction = static_cast<uint_type>(fraction >> 4);
800 << std::setfill('0') << std::hex << fraction;
1006 uint_type fraction = 0;
[all …]
/external/angle/third_party/vulkan-deps/spirv-tools/src/source/util/
Dhex_float.h756 uint_type fraction = static_cast<uint_type>((bits & HF::fraction_encode_mask)
759 const bool is_zero = exponent == 0 && fraction == 0;
773 while ((fraction & HF::fraction_top_bit) == 0) {
774 fraction = static_cast<uint_type>(fraction << 1);
779 fraction = static_cast<uint_type>(fraction << 1); // eat the leading 1
780 fraction &= HF::fraction_represent_mask;
786 while (fraction_nibbles > 0 && (fraction & 0xF) == 0) {
788 fraction = static_cast<uint_type>(fraction >> 4);
800 << std::setfill('0') << std::hex << fraction;
1006 uint_type fraction = 0;
[all …]
/external/python/python-api-core/google/api_core/
Ddatetime_helpers.py148 fraction = with_nanos.group("nanos")
150 if fraction is None:
153 scale = 9 - len(fraction)
154 nanos = int(fraction) * (10 ** scale)
243 fraction = with_nanos.group("nanos")
244 if fraction is None:
247 scale = 9 - len(fraction)
248 nanos = int(fraction) * (10 ** scale)
/external/skia/gm/
Dstringart.cpp74 SkScalar fraction = 1.0f - TimeUtils::Scaled(1e-9 * nanos, 2.0f/kDesiredDurationSecs, 2.0f); in onAnimate() local
75 if (fraction <= 0.0f) { in onAnimate()
76 fraction = -fraction; in onAnimate()
79 SkASSERT(fraction >= 0.0f && fraction <= 1.0f); in onAnimate()
81 fNumSteps = (int) (fraction * kMaxNumSteps); in onAnimate()
/external/lottie/lottie/src/main/java/com/airbnb/lottie/utils/
DGammaEvaluator.java27 public static int evaluate(float fraction, int startInt, int endInt) { in evaluate() argument
51 float a = startA + fraction * (endA - startA); in evaluate()
52 float r = startR + fraction * (endR - startR); in evaluate()
53 float g = startG + fraction * (endG - startG); in evaluate()
54 float b = startB + fraction * (endB - startB); in evaluate()
/external/protobuf/src/google/protobuf/stubs/
Dmathutil.h133 const T fraction, const T margin);
138 const T fraction, const T margin) { in WithinFractionOrMargin() argument
140 GOOGLE_DCHECK((T(0) < fraction || T(0) == fraction) && in WithinFractionOrMargin()
141 fraction < T(1) && in WithinFractionOrMargin()
154 T relative_margin = static_cast<T>(fraction * Max(Abs(x), Abs(y))); in WithinFractionOrMargin()
/external/cronet/third_party/protobuf/src/google/protobuf/stubs/
Dmathutil.h133 const T fraction, const T margin);
138 const T fraction, const T margin) { in WithinFractionOrMargin() argument
140 GOOGLE_DCHECK((T(0) < fraction || T(0) == fraction) && in WithinFractionOrMargin()
141 fraction < T(1) && in WithinFractionOrMargin()
154 T relative_margin = static_cast<T>(fraction * Max(Abs(x), Abs(y))); in WithinFractionOrMargin()
/external/fonttools/Tests/feaLib/data/
Dspec5d1.fea5 sub [one one.oldstyle] [slash fraction] [two two.oldstyle] by onehalf;
17 sub one fraction two by onehalf;
18 sub one.oldstyle fraction two by onehalf;
21 sub one fraction two.oldstyle by onehalf;
22 sub one.oldstyle fraction two.oldstyle by onehalf;
/external/opencensus-java/impl_core/src/main/java/io/opencensus/implcore/stats/
DMutableAggregation.java65 abstract void combine(MutableAggregation other, double fraction); in combine() argument
93 void combine(MutableAggregation other, double fraction) { in combine() argument
95 this.sum += fraction * ((MutableSumDouble) other).sum; in combine()
162 void combine(MutableAggregation other, double fraction) { in combine() argument
164 this.count += Math.round(fraction * ((MutableCount) other).getCount()); in combine()
211 void combine(MutableAggregation other, double fraction) { in combine() argument
214 this.count += Math.round(mutableMean.count * fraction); in combine()
215 this.sum += mutableMean.sum * fraction; in combine()
335 void combine(MutableAggregation other, double fraction) { in combine() argument
337 if (Math.abs(1.0 - fraction) > TOLERANCE) { in combine()
[all …]

12345678910>>...14