/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include "libm.h"
static const int
static const long double
#ifdef __LITTLE_ENDIAN
#define __H3(x) *(0 + (int *) &x)
#else
#define __H0(x) *(0 + (int *) &x)
#endif
long double
fmodl(long double x, long double y) {
long double a, b;
int hx;
y0 &= 0x7fffffff;
/* purge off exception values */
return ((x * y) / (x * y));
a = fabsl(x);
b = fabsl(y);
if (a <= b) {
if (a < b)
return (x);
else
return (zero * x);
}
/* determine ix = ilogbl(x) */
ix = -16382;
while (x0 == 0) {
ix -= 16;
}
ix -= 1;
x3 <<= 1;
}
} else {
}
/* determine iy = ilogbl(y) */
iy = -16382;
while (y0 == 0) {
iy -= 16;
}
iy -= 1;
y3 <<= 1;
}
} else {
}
/* fix point fmod */
while (n--) {
while (x0 == 0 && n >= 16) {
n -= 16;
}
n -= 1;
}
carry = 0;
if (carry == 0) {
} else {
}
if (carry == 0) {
} else {
}
if (z0 < 0) { /* double x */
} else {
if (z0 == 0) {
return (a);
}
}
/* x = z << 1 */
}
}
carry = 0;
if (carry == 0) {
} else {
}
if (carry == 0) {
} else {
}
if (z0 >= 0) {
}
/* convert back to floating value and restore the sign */
return (a);
}
if (x0 == 0) {
iy -= 16;
} else {
iy -= 1;
}
}
/* normalize output */
if (iy >= -16382) {
} else { /* subnormal output */
n = -16382 - iy;
k = n & 31;
if (k != 0) {
if (k <= 16) {
x0 >>= k;
} else {
x0 = 0;
}
}
while (n >= 32) {
n -= 32;
x0 = 0;
}
a *= one;
}
return (a);
}