2N/A * The contents of this file are subject to the terms of the 2N/A * Common Development and Distribution License, Version 1.0 only 2N/A * (the "License"). You may not use this file except in compliance 2N/A * See the License for the specific language governing permissions 2N/A * and limitations under the License. 2N/A * When distributing Covered Code, include this CDDL HEADER in each 2N/A * If applicable, add the following below this CDDL HEADER, with the 2N/A * fields enclosed by brackets "[]" replaced with your own identifying 2N/A * information: Portions Copyright [yyyy] [name of copyright owner] 2N/A * Copyright (c) 1994-1997, by Sun Microsystems, Inc. 2N/A * All rights reserved. 2N/A#
pragma ident "%Z%%M% %I% %E% SMI" 2N/A * This file contains __quad_mag_add and __quad_mag_sub, the core 2N/A * of the quad precision add and subtract operations. 2N/A * __quad_mag_add(x, y, z, fsr) 2N/A * Sets *z = *x + *y, rounded according to the rounding mode in *fsr, 2N/A * and updates the current exceptions in *fsr. This routine assumes 2N/A * *x and *y are finite, with the same sign (i.e., an addition of 2N/A * magnitudes), |*x| >= |*y|, and *z already has its sign bit set. 2N/A /* get the leading significand words and exponents */ 2N/A /* prenormalize y */ 2N/A }
else if (e >=
64) {
2N/A }
else if (e >=
32) {
2N/A /* add, propagating carries */ 2N/A /* keep track of whether the result before rounding is tiny */ 2N/A /* get the rounding mode, fudging directed rounding modes */ 2N/A /* as though the result were positive */ 2N/A /* see if we need to round */ 2N/A /* round up if necessary */ 2N/A /* check for overflow */ 2N/A /* store the default overflowed result */ 2N/A /* store the result */ 2N/A /* if the pre-rounded result was tiny and underflow trapping */ 2N/A /* is enabled, simulate underflow */ 2N/A * __quad_mag_sub(x, y, z, fsr) 2N/A * Sets *z = *x - *y, rounded according to the rounding mode in *fsr, 2N/A * and updates the current exceptions in *fsr. This routine assumes 2N/A * *x and *y are finite, with opposite signs (i.e., a subtraction of 2N/A * magnitudes), |*x| >= |*y|, and *z already has its sign bit set. 2N/A /* get the leading significand words and exponents */ 2N/A /* prenormalize y */ 2N/A }
else if (e >=
64) {
2N/A }
else if (e >=
32) {
2N/A }
else if (e ==
1) {
2N/A /* complement guard, round, and sticky as need be */ 2N/A /* subtract, propagating borrows */ 2N/A /* get the rounding mode */ 2N/A /* handle zero result */ 2N/A /* if cancellation occurred or the exponent is 1, */ 2N/A /* the result is exact */ 2N/A /* if the result is tiny and underflow trapping is */ 2N/A /* enabled, simulate underflow */ 2N/A /* otherwise we only borrowed one place */ 2N/A /* fudge directed rounding modes as though the result were positive */ 2N/A /* see if we need to round */ 2N/A /* round up if necessary */ 2N/A /* store the result */