_scalb, _scalbl

Aus RAD Studio
Wechseln zu: Navigation, Suche

Nach oben zu float.h - Index


Header-Datei

float.h

Kategorie

Mathematische Routinen

Prototyp

double _scalb(double d, long exp);

long double _scalbl(long double ld, long exp);

Beschreibung

Skaliert das Argument d um eine Zweierpotenz.

_scalbl ist die long double-Version; sie übernimmt ein Argument vom Typ long double und gibt ein Ergebnis vom Typ long double zurück.

Rückgabewert

Bei erfolgreicher Ausführung wird ein Exponentialwert zurückgegeben. Wenn ein Überlauf auftritt, gibt die Funktion (abhängig vom Vorzeichen des Arguments) +/– HUGE_VAL zurück. Die Variable ERRNO wird auf ERANGE gesetzt.

Beispiel

#include <float.h>

int _tmain(int argc, _TCHAR* argv[])
{
  double number;
  long exp;

  /* Request the number and exponent */
  printf("Enter the value and exponent: ");
  scanf("%lf %u", &number, &exp);

  /* Scale the number using */
  printf("Number * (2^Exp) = %lf\n",  _scalb(number, exp));

  return 0;
}

Portabilität

POSIX Win32 ANSI C ANSI C++

_scalb

+

_scalbl

+