Atmel Software Framework

precision.h File Reference

ASF Sensor API Numeric Precision.

This module defines numeric precision and the real-number representation used in the Atmel Software Framework common sensor service.

Copyright (c) 2011-2012 Atmel Corporation. All rights reserved.

#include "fixed.h"

Data Structures

struct  vector3_t
 scalar 3-dimensional vector More...


typedef float float_t
 Scalar Value Format and Precision. More...
typedef float_t scalar
 Floating-point scalar type. More...
typedef scalar scalar_t


static scalar_t vector3_dot_product (vector3_t const *v, vector3_t const *w)
 Calculate a vector3_t dot-product. More...
static scalar_t vector3_magnitude (vector3_t const *v)
 Calculate a vector3_t magnitude. More...
static void vector3_scale (scalar_t s, vector3_t *v)
 Scale a vector3_t value (scalar multiplication) More...

typedef float float_t

Scalar Value Format and Precision.

These types define a real number format and precision. C/C++ source code can be compiled with math libraries in single-precision floating point, double-precision floating point, or fixed-point versions.

The type float_t always specifies a C/C++ floating-point type and is a C99 standard type. The scalar type may be specified as a floating-point or fixed-point type, where the available fixed-point types are fixed_t (C/C++) and type math::fixed (C++ only).

Note that whenever the C++ math libraries - math::vector, math::matrix, &c.

  • are built, scalar must be an alias for float_t or math::fixed and never fixed_t.clib (C99) floating-point format
typedef float_t scalar

Floating-point scalar type.

typedef scalar scalar_t

static scalar_t vector3_dot_product ( vector3_t const *  v,
vector3_t const *  w 

Calculate a vector3_t dot-product.

References vector3_t::x, vector3_t::y, and vector3_t::z.

Referenced by vector3_magnitude().

static scalar_t vector3_magnitude ( vector3_t const *  v)

Calculate a vector3_t magnitude.

References vector3_dot_product().

Referenced by field_direction().

static void vector3_scale ( scalar_t  s,
vector3_t v 

Scale a vector3_t value (scalar multiplication)

References s, vector3_t::x, vector3_t::y, and vector3_t::z.

Referenced by ak8975_get_field(), field_direction(), and hmc5883l_get_field().