Reactos
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

at listview 41 lines 858 B view raw
1/* 2 * PROJECT: ReactOS CRT 3 * LICENSE: MIT (https://spdx.org/licenses/MIT) 4 * PURPOSE: Implementation of scalbnf. 5 * COPYRIGHT: Imported from musl libc 6 * https://git.musl-libc.org/cgit/musl/tree/src/math/scalbnf.c 7 * blob: a5ad208b69929f24336fae40e6af37101c99a72f 8 * See https://git.musl-libc.org/cgit/musl/tree/COPYRIGHT 9 */ 10 11#include <math.h> 12#include <stdint.h> 13 14float scalbnf(float x, int n) 15{ 16 union {float f; uint32_t i;} u; 17 float_t y = x; 18 19 if (n > 127) { 20 y *= 0x1p127f; 21 n -= 127; 22 if (n > 127) { 23 y *= 0x1p127f; 24 n -= 127; 25 if (n > 127) 26 n = 127; 27 } 28 } else if (n < -126) { 29 y *= 0x1p-126f * 0x1p24f; 30 n += 126 - 24; 31 if (n < -126) { 32 y *= 0x1p-126f * 0x1p24f; 33 n += 126 - 24; 34 if (n < -126) 35 n = -126; 36 } 37 } 38 u.i = (uint32_t)(0x7f+n)<<23; 39 x = y * u.f; 40 return x; 41}