spinn_common 7.1.1
Support code for SpiNNaker applications.
Loading...
Searching...
No Matches
Macros | Functions
sqrt.h File Reference

Implementation of square root for the s1615 type, returning a s1615 result. More...

#include <stdfix-full-iso.h>

Go to the source code of this file.

Macros

#define sqrtfx(f)
 Square root.
 

Functions

uint64_t recip_normalized_root (uint32_t x)
 Calculates the reciprocal square-root of the argument.
 
s1615 sqrtk (s1615 x)
 Square root.
 
s07 sqrthr (s07 x)
 Square root.
 
s015 sqrtr (s015 x)
 Square root.
 
s031 sqrtlr (s031 x)
 Square root.
 
s87 sqrthk (s87 x)
 Square root.
 
s3231 sqrtlk (s3231 x)
 Square root.
 
u08 sqrtuhr (u08 x)
 Square root.
 
u016 sqrtur (u016 x)
 Square root.
 
u032 sqrtulr (u032 x)
 Square root.
 
u88 sqrtuhk (u88 x)
 Square root.
 
u1616 sqrtuk (u1616 x)
 Square root.
 
u3232 sqrtulk (u3232 x)
 Square root.
 

Detailed Description

Implementation of square root for the s1615 type, returning a s1615 result.

The details of the algorithm are from "Elementary Functions: Algorithms and Implementation", 2nd edn, Jean-Michel Muller, Birkhauser, 2006.

Author
Dave Lester (david.nosp@m..r.l.nosp@m.ester.nosp@m.@man.nosp@m.chest.nosp@m.er.a.nosp@m.c.uk)
Date
23 October, 2014

Macro Definition Documentation

◆ sqrtfx

#define sqrtfx (   f)
Value:
_Generic((f), \
s07: sqrthr(f), \
s015: sqrtr(f), \
s031: sqrtlr(f), \
s87: sqrthk(f), \
s1615: sqrtk(f), \
s3231: sqrtlk(f), \
u08: sqrtuhr(f), \
u016: sqrtur(f), \
u032: sqrtulr(f), \
u88: sqrtuhk(f), \
u1616: sqrtuk(f), \
u3232: sqrtulk(f), \
default: __builtin_trap() \
)
u3232 sqrtulk(u3232 x)
Square root.
s07 sqrthr(s07 x)
Square root.
u1616 sqrtuk(u1616 x)
Square root.
u032 sqrtulr(u032 x)
Square root.
s87 sqrthk(s87 x)
Square root.
u88 sqrtuhk(u88 x)
Square root.
s1615 sqrtk(s1615 x)
Square root.
Definition sqrt.c:395
s031 sqrtlr(s031 x)
Square root.
s3231 sqrtlk(s3231 x)
Square root.
u08 sqrtuhr(u08 x)
Square root.
u016 sqrtur(u016 x)
Square root.
s015 sqrtr(s015 x)
Square root.
short fract s07
An alternative name for the signed short fract type.
Definition stdfix-full-iso.h:172
unsigned fract u016
An alternative name for the unsigned fract type.
Definition stdfix-full-iso.h:193
unsigned accum u1616
An alternative name for the unsigned accum type.
Definition stdfix-full-iso.h:202
long accum s3231
An alternative name for the signed long accum type.
Definition stdfix-full-iso.h:187
fract s015
An alternative name for the signed fract type.
Definition stdfix-full-iso.h:175
unsigned short fract u08
An alternative name for the unsigned short fract type.
Definition stdfix-full-iso.h:190
long fract s031
An alternative name for the signed long fract type.
Definition stdfix-full-iso.h:178
short accum s87
An alternative name for the signed short accum type.
Definition stdfix-full-iso.h:181
unsigned short accum u88
An alternative name for the unsigned short accum type.
Definition stdfix-full-iso.h:199
accum s1615
An alternative name for the signed accum type.
Definition stdfix-full-iso.h:184
unsigned long fract u032
An alternative name for the unsigned long fract type.
Definition stdfix-full-iso.h:196
unsigned long accum u3232
An alternative name for the unsigned long accum type.
Definition stdfix-full-iso.h:205

Square root.

Parameters
[in]fNon-negative value to get the square root of
Returns
the square root of f
Todo:
Test that this actually works!

Function Documentation

◆ recip_normalized_root()

uint64_t recip_normalized_root ( uint32_t  x)
extern

Calculates the reciprocal square-root of the argument.

Parameters
[in]xAn unsigned integer, representing a u1.31. Leading bit is 1.
Returns
An unsigned 64-bit integer representing the reciprocal square-root of x, as a u0.64.
Parameters
[in]xAn unsigned integer, representing a u1.31. Leading bit is 1.
Returns
An unsigned 64-bit integer representing the reciprocal square-root of x, as a u0.64.
Todo:
INCORRECT FORMAT DOCUMENTATION. FIX THIS!

◆ sqrtk()

s1615 sqrtk ( s1615  x)
extern

Square root.

Parameters
[in]xNon-negative value to get the square root of
Returns
the square root of x

◆ sqrthr()

s07 sqrthr ( s07  x)

Square root.

Warning
Unimplemented
Parameters
[in]xNon-negative value to get the square root of
Returns
the square root of x

◆ sqrtr()

s015 sqrtr ( s015  x)

Square root.

Warning
Unimplemented
Parameters
[in]xNon-negative value to get the square root of
Returns
the square root of x

◆ sqrtlr()

s031 sqrtlr ( s031  x)

Square root.

Warning
Unimplemented
Parameters
[in]xNon-negative value to get the square root of
Returns
the square root of x

◆ sqrthk()

s87 sqrthk ( s87  x)

Square root.

Warning
Unimplemented
Parameters
[in]xNon-negative value to get the square root of
Returns
the square root of x

◆ sqrtlk()

s3231 sqrtlk ( s3231  x)

Square root.

Warning
Unimplemented
Parameters
[in]xNon-negative value to get the square root of
Returns
the square root of x

◆ sqrtuhr()

u08 sqrtuhr ( u08  x)

Square root.

Warning
Unimplemented
Parameters
[in]xNon-negative value to get the square root of
Returns
the square root of x

◆ sqrtur()

u016 sqrtur ( u016  x)

Square root.

Warning
Unimplemented
Parameters
[in]xNon-negative value to get the square root of
Returns
the square root of x

◆ sqrtulr()

u032 sqrtulr ( u032  x)

Square root.

Warning
Unimplemented
Parameters
[in]xNon-negative value to get the square root of
Returns
the square root of x

◆ sqrtuhk()

u88 sqrtuhk ( u88  x)

Square root.

Warning
Unimplemented
Parameters
[in]xNon-negative value to get the square root of
Returns
the square root of x

◆ sqrtuk()

u1616 sqrtuk ( u1616  x)

Square root.

Warning
Unimplemented
Parameters
[in]xNon-negative value to get the square root of
Returns
the square root of x

◆ sqrtulk()

u3232 sqrtulk ( u3232  x)

Square root.

Warning
Unimplemented
Parameters
[in]xNon-negative value to get the square root of
Returns
the square root of x