Microchip’s ANSI C compiler provides full floating point math capability, enabling both the single and double precision floating point operations found in any standard ANSI C compiler. These include functions such as sin, cos, tan, and other common mathematical operations. The standard ANSI C floating point library is part of the MPLAB compiler and is documented in the MPLAB C32 C Libraries Manual. The library works with all PIC32 devices
|
|
|
|
|
Common Floating Point Functions
|
|
Features
|
Function
|
Description
|
Average Single Precision Performance
|
|
• Free library included with MPLAB compiler
• Compatible with all devices in the Microchip PIC32 family
• Full compatibility with standard ANSI C floating point math libraries.
• Support for double or single precision floating point
• Includes common operations such as sin, cos, tan, etc.
Getting Started
• Download and install MPLAB and the free trial version of the C32 C compiler
• See Chapter 2 of the MPLAB C32 C Libraries Manual
• Start writing floating point code!
|
sin/sinf*
|
Sin of a double/single precision floating point variable
|
299 cycles
|
|
cos/cosf*
|
Cos of a double/single precision floating point variable
|
299 cycels
|
|
tan/tanf*
|
Tan of a double/single precision floating point variable
|
389 cycles
|
|
exp/expf*
|
Calculates the exponential function of a double/single precision floating point variable
|
133 cycles
|
|
fabs/fabsf*
|
Calculates the absolute value of a double/single precision floating point variable
|
6 cycles
|
|
fmod/fmodf*
|
Calculates the remainder of x/y as a double/single precision floating point value
|
86 cycles
|
|
log/logf*
|
Calculates the log of a double/single precision variable
|
301 cycles
|
|
sqrt/sqrtf*
|
Calculates the square root of a double/single precision variable
|
237 cycles
|
|
pow/powf*
|
Calculates x raised to the power of y
|
367 cycles
|
|
floor/floorf*
|
Calculates the floor of a double/single precision floating point variable
|
33 cycles
|
|
ceil/ceilf*
|
Calculates the ceiling of a double/single precision floating point variable
|
34 cycles
|
|
asin/asinf*
|
Arc sin of a double/single precision floating point variable
|
618 cycles
|
|
acos/acosf*
|
Arc cos of a double/single precision floating point variable
|
685 cycles
|
|
atan/atanf*
|
Arc tan of a double/single precision floating point variable
|
353 cycles
|
|
*- “f” denotes single precision floating point number