Lines Matching +full:quad +full:- +full:precision

1 /*-
2 * SPDX-License-Identifier: BSD-3-Clause
8 * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
36 #include "quad.h"
41 * Our algorithm is based on the following. Split incoming quad values
60 * (2^n) (u1 v0 - u1 v1 + u0 v1 - u0 v0) +
66 * (2^n) (u1 - u0) (v0 - v1) + [(u1-u0)... = mid]
69 * The terms (u1 v1), (u1 - u0) (v0 - v1), and (u0 v0) can all be done
70 * in just half the precision of the original. (Note that either or both
71 * of (u1 - u0) or (v0 - v1) may be negative.)
75 * Since C does not give us a `long * long = quad' operator, we split
80 * Our product should, strictly speaking, be a `long quad', with 128
116 u.q = -a, negall = 1; in __muldi3()
120 v.q = -b, negall ^= 1; in __muldi3()
139 negmid = 0, udiff = u1 - u0; in __muldi3()
141 negmid = 1, udiff = u0 - u1; in __muldi3()
143 vdiff = v0 - v1; in __muldi3()
145 vdiff = v1 - v0, negmid ^= 1; in __muldi3()
153 prod.ul[H] = high + (negmid ? -mid : mid) + low.ul[L] + in __muldi3()
157 return (negall ? -prod.q : prod.q); in __muldi3()
165 * Multiply two 2N-bit longs to produce a 4N-bit quad, where N is half
166 * the number of bits in a long (whatever that is---the code below
167 * does not care as long as quad.h does its part of the bargain---but
172 * we can get away with native multiplication---none of our input terms
175 * Note that, for u_long l, the quad-precision result
196 /* This is the same small-number optimization as before. */ in __lmulq()
201 udiff = u1 - u0, neg = 0; in __lmulq()
203 udiff = u0 - u1, neg = 1; in __lmulq()
205 vdiff = v0 - v1; in __lmulq()
207 vdiff = v1 - v0, neg ^= 1; in __lmulq()
216 /* if (neg) prod -= mid << N; else prod += mid << N; */ in __lmulq()
219 prodl -= LHUP(mid); in __lmulq()
220 prodh -= HHALF(mid) + (prodl > was); in __lmulq()
235 /* return 4N-bit product */ in __lmulq()