this repo has no description
at fixPythonPipStalling 77 lines 1.3 kB view raw
1 2/* 3 * logb.c 4 * 5 * by Ian Ollmann 6 * 7 * Copyright (c) 2007, Apple Inc. All Rights Reserved. 8 * 9 * Unix 2003 implementation of logb() 10 */ 11 12#include <math.h> 13#include <stdint.h> 14 15#ifdef ARMLIBM_SET_FLAGS 16 17#include "required_arithmetic.h" 18 19float logbf( float x ) 20{ 21 union{ float f; uint32_t u;}u = {x}; 22 23 u.u &= 0x7fffffffU; 24 int32_t exp = u.u >> 23; 25 26 if( __builtin_expect( (uint32_t) exp - 1U >= 254, 0 ) ) 27 { // +-0, +-denorm, +-inf, NaN 28 if( 0.0f == x ) 29 return required_divide_float( -1.0f, 0.0f ); //set div/0, return -inf 30 31 if( x != x ) 32 return x + x; 33 34 if( u.u == 0x7f800000U ) 35 return __builtin_inff(); 36 37 u.u |= 0x3f800000U; 38 u.f -= 1.0f; 39 exp = u.u >> 23; 40 41 return (float) (exp - (127+126)); 42 } 43 44 return (float) (exp - 127); 45} 46 47#else 48 49float logbf( float x ) 50{ 51 union{ float f; uint32_t u;}u = {x}; 52 53 u.u &= 0x7fffffffU; 54 int32_t exp = u.u >> 23; 55 56 if( __builtin_expect( (uint32_t) exp - 1U >= 254, 0 ) ) 57 { // +-0, +-denorm, +-inf, NaN 58 if( 0.0f == x ) 59 return -__builtin_inff(); //set div/0, return -inf 60 61 if( x != x ) 62 return x + x; 63 64 if( u.u == 0x7f800000U ) 65 return __builtin_inff(); 66 67 u.u |= 0x3f800000U; 68 u.f -= 1.0f; 69 exp = u.u >> 23; 70 71 return (float) (exp - (127+126)); 72 } 73 74 return (float) (exp - 127); 75} 76 77#endif