1130766Sdas/*- 2130766Sdas * Copyright (c) 2004 David Schultz <das@FreeBSD.ORG> 3130766Sdas * All rights reserved. 4130766Sdas * 5130766Sdas * Redistribution and use in source and binary forms, with or without 6130766Sdas * modification, are permitted provided that the following conditions 7130766Sdas * are met: 8130766Sdas * 1. Redistributions of source code must retain the above copyright 9130766Sdas * notice, this list of conditions and the following disclaimer. 10130766Sdas * 2. Redistributions in binary form must reproduce the above copyright 11130766Sdas * notice, this list of conditions and the following disclaimer in the 12130766Sdas * documentation and/or other materials provided with the distribution. 13130766Sdas * 14130766Sdas * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15130766Sdas * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16130766Sdas * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17130766Sdas * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18130766Sdas * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19130766Sdas * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20130766Sdas * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21130766Sdas * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22130766Sdas * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23130766Sdas * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24130766Sdas * SUCH DAMAGE. 25130766Sdas */ 26130766Sdas 27130766Sdas#include <sys/cdefs.h> 28130766Sdas__FBSDID("$FreeBSD: releng/10.2/lib/msun/src/s_scalbln.c 284810 2015-06-25 13:01:10Z tijl $"); 29130766Sdas 30130766Sdas#include <math.h> 31130766Sdas 32284810Stijl#define NMAX 65536 33284810Stijl#define NMIN -65536 34284810Stijl 35130766Sdasdouble 36284810Stijlscalbln(double x, long n) 37130766Sdas{ 38130766Sdas 39284810Stijl return (scalbn(x, (n > NMAX) ? NMAX : (n < NMIN) ? NMIN : (int)n)); 40130766Sdas} 41130766Sdas 42130766Sdasfloat 43284810Stijlscalblnf(float x, long n) 44130766Sdas{ 45130766Sdas 46284810Stijl return (scalbnf(x, (n > NMAX) ? NMAX : (n < NMIN) ? NMIN : (int)n)); 47130766Sdas} 48143219Sdas 49143219Sdaslong double 50284810Stijlscalblnl(long double x, long n) 51143219Sdas{ 52143219Sdas 53284810Stijl return (scalbnl(x, (n > NMAX) ? NMAX : (n < NMIN) ? NMIN : (int)n)); 54143219Sdas} 55