Skip to content
Snippets Groups Projects
Select Git revision
  • 31a49f641d56b23eb4de20b17a63f6759c702e97
  • master default protected
  • genofire/ble-rewrite
  • koalo/bhi160
  • rahix/simple_menu
  • ch3/splashscreen
  • koalo/bhi160-works-but-dirty
  • ios-workarounds
  • koalo/wip/i2c-for-python
  • renze/safe_mode
  • renze/hatchery_apps
  • schneider/fundamental-test
  • koalo/factory-reset
  • msgctl/gfx_rle
  • msgctl/faultscreen
  • msgctl/textbuffer_api
  • schneider/bonding
  • schneider/bootloader-update-9a0d158
  • schneider/bsec
  • rahix/bma
  • rahix/bhi
  • v1.3
  • v1.2
  • v1.1
  • v1.0
  • release-1
  • bootloader-v1
  • v0.0
28 results

meson.build

Blame
  • Forked from card10 / firmware
    Source project has a limited visibility.
    roundf.c 762 B
    /*****************************************************************************/
    /*****************************************************************************/
    // roundf from musl-0.9.15
    /*****************************************************************************/
    /*****************************************************************************/
    
    #include "libm.h"
    
    float roundf(float x)
    {
    	union {float f; uint32_t i;} u = {x};
    	int e = u.i >> 23 & 0xff;
    	float_t y;
    
    	if (e >= 0x7f+23)
    		return x;
    	if (u.i >> 31)
    		x = -x;
    	if (e < 0x7f-1) {
    		FORCE_EVAL(x + 0x1p23f);
    		return 0*u.f;
    	}
    	y = (float)(x + 0x1p23f) - 0x1p23f - x;
    	if (y > 0.5f)
    		y = y + x - 1;
    	else if (y <= -0.5f)
    		y = y + x + 1;
    	else
    		y = y + x;
    	if (u.i >> 31)
    		y = -y;
    	return y;
    }