summaryrefslogtreecommitdiff
path: root/src/math/i386/sqrtf.c
blob: 41c65c2bdbbddaf1fb74ea8f467a547cc27a50ea (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
#include <math.h>

float sqrtf(float x)
{
	long double t;
	/* The long double result has sufficient precision so that
	 * second rounding to float still keeps the returned value
	 * correctly rounded, see Pierre Roux, "Innocuous Double
	 * Rounding of Basic Arithmetic Operations". */
	__asm__ ("fsqrt" : "=t"(t) : "0"(x));
	return (float)t;
}