w_j0.c revision 6b15695578f07a3f72c4c9475c1a261a3021472a
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen *
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen * ***** BEGIN LICENSE BLOCK *****
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen *
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen * The contents of this file are subject to the Mozilla Public License Version
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen * 1.1 (the "License"); you may not use this file except in compliance with
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen * the License. You may obtain a copy of the License at
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen * http://www.mozilla.org/MPL/
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen *
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen * Software distributed under the License is distributed on an "AS IS" basis,
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen * for the specific language governing rights and limitations under the
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen * License.
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen *
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen * The Original Code is Mozilla Communicator client code, released
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen * March 31, 1998.
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen *
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen * The Initial Developer of the Original Code is
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen * Sun Microsystems, Inc.
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen * Portions created by the Initial Developer are Copyright (C) 1998
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen * the Initial Developer. All Rights Reserved.
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen *
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen * Contributor(s):
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen *
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen * Alternatively, the contents of this file may be used under the terms of
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen * either of the GNU General Public License Version 2 or later (the "GPL"),
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen * in which case the provisions of the GPL or the LGPL are applicable instead
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen * of those above. If you wish to allow use of your version of this file only
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen * under the terms of either the GPL or the LGPL, and not to allow others to
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen * use your version of this file under the terms of the MPL, indicate your
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen * decision by deleting the provisions above and replace them with the notice
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen * and other provisions required by the GPL or the LGPL. If you do not delete
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen * the provisions above, a recipient may use your version of this file under
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen * the terms of any one of the MPL, the GPL or the LGPL.
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen *
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen * ***** END LICENSE BLOCK ***** */
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen/* @(#)w_j0.c 1.3 95/01/18 */
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen/*
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen * ====================================================
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen *
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen * Developed at SunSoft, a Sun Microsystems, Inc. business.
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen * Permission to use, copy, modify, and distribute this
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen * software is freely granted, provided that this notice
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen * is preserved.
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen * ====================================================
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen */
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen/*
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen * wrapper j0(double x), y0(double x)
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen */
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen#include "fdlibm.h"
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen#ifdef __STDC__
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen double fd_j0(double x) /* wrapper j0 */
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen#else
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen double fd_j0(x) /* wrapper j0 */
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen double x;
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen#endif
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen{
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen#ifdef _IEEE_LIBM
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen return __ieee754_j0(x);
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen#else
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen double z = __ieee754_j0(x);
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen if(_LIB_VERSION == _IEEE_ || fd_isnan(x)) return z;
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen if(fd_fabs(x)>X_TLOSS) {
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen int err;
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen return __kernel_standard(x,x,34,&err); /* j0(|x|>X_TLOSS) */
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen } else
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen return z;
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen#endif
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen}
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen#ifdef __STDC__
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen double y0(double x) /* wrapper y0 */
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen#else
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen double y0(x) /* wrapper y0 */
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen double x;
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen#endif
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen{
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen#ifdef _IEEE_LIBM
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen return __ieee754_y0(x);
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen#else
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen double z;
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen int err;
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen z = __ieee754_y0(x);
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen if(_LIB_VERSION == _IEEE_ || fd_isnan(x) ) return z;
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen if(x <= 0.0){
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen if(x==0.0)
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen /* d= -one/(x-x); */
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen return __kernel_standard(x,x,8,&err);
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen else
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen /* d = zero/(x-x); */
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen return __kernel_standard(x,x,9,&err);
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen }
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen if(x>X_TLOSS) {
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen return __kernel_standard(x,x,35,&err); /* y0(x>X_TLOSS) */
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen } else
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen return z;
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen#endif
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen}
5738b9afc93525510fa01185f7609fd5cbb0ff1aJohan Engelen