Lines Matching defs:errors
76 // Track errors to as a factor of unit in last-precision.
77 let mut errors: u32 = 0;
79 errors += error_halfscale();
94 errors += error_halfscale();
105 if errors > 0 {
106 errors += 1;
108 errors += error_halfscale();
110 // Normalize the floating point (and the errors).
112 errors <<= shift;
120 // Too many errors accumulated, return an error.
121 if !error_is_accurate::<F>(errors, &fp) {
129 // giving a case where we have too many errors and need to round-up.
146 // Calculate if the errors in calculating the extended-precision float.
174 /// Determine if the number of errors is tolerable for float precision.
175 fn error_is_accurate<F: Float>(errors: u32, fp: &ExtendedFloat) -> bool {
201 // mantissa and the errors during calculation differ significantly
214 // cmp1 = (halfway - errors) < extra
215 // cmp1 = extra < (halfway + errors)
222 // errors = 0b00000100
223 // halfway - errors = 0b01111100
224 // halfway + errors = 0b10000100
227 // halfway - errors = 124
228 // halfway + errors = 132
233 // halfway - errors = 124
234 // halfway + errors = -124
241 // Since errors will always be small, and since we want to detect
245 let errors = errors as u64;
251 // overflow to the next bit within errors. If it overflows,
253 !fp.mant.overflowing_add(errors).1
261 let cmp1 = halfway.wrapping_sub(errors) < extra;
262 let cmp2 = extra < halfway.wrapping_add(errors);