# RainbowBS Manual: conversion releted

#### RainbowBS

 RainbowBS Manual  v0.1.0 Written by QWQ([email protected])
conversion releted

## convert digit to string

enum  ePOW { SHEX, SBINARY, SDECIMAL }
Specific hex,binary or decimal. More...

U8 RBS_Number2String (U32 value, ePOW ePow, U8 length, char *pText)
Convert unsigned digit to ASCII string. More...

## trigonometric releted

int RBS_sin (int angle)
Calculate sine. More...

int RBS_cos (int angle)
Calculate cosine. More...

int RBS_tan (int angle)
Calculate tangent. More...

int RBS_ctan (int angle)
Calculate cotangent. More...

#define ANG_45DEG   1024

#define ANG_90DEG   (2*ANG_45DEG)

#define ANG_135DEG   (3*ANG_45DEG)

#define ANG_180DEG   (4*ANG_45DEG)

#define ANG_225DEG   (5*ANG_45DEG)

#define ANG_270DEG   (6*ANG_45DEG)

#define ANG_315DEG   (7*ANG_45DEG)

#define ANG_360DEG   (8*ANG_45DEG)

## Enumeration Type Documentation

 enum ePOW
Enumerator
SHEX

hex

SBINARY

binary

SDECIMAL

decimal

## Function Documentation

 int RBS_cos ( int angle )

This function calculates cosine without using float-point numbers.It use a constant table to look up for the appropriate value.

Parameters
 [in] angle angle=degrees*ANG_45DEG/45,degrees=angle*45/ANG_45DEG.
Returns
cos(degrees)*1024.
 int RBS_ctan ( int angle )

This function calculates cotangent without using float-point numbers.It use a constant table to look up for the appropriate value.

Parameters
 [in] angle angle=degrees*ANG_45DEG/45,degrees=angle*45/ANG_45DEG.
Returns
cotan(degrees)*1024.
 U8 RBS_Number2String ( U32 value, ePOW ePow, U8 length, char * pText )
Parameters
 [in] value unsigned digit. [in] ePow choose hex,binary or decimal. [in] length Max.bits from lowest bit.If Len is 0,choosing Min.characters automatically. [out] pText output string buffer.
Returns
character number.
ePOW
 int RBS_sin ( int angle )

This function calculates sine without using float-point numbers. It use a constant table to look up for the approximate value.

Parameters
 [in] angle angle=degrees*ANG_45DEG/45,degrees=angle*45/ANG_45DEG.
Returns
sin(degrees)*1024.

Example:

1 //calculate sine of 30 degrees,the return value is 511 which
2 //is approximately equal to sin30*1024 which is 512.
3 int value = RBS_sin(30*ANG_45DEG/45);
 int RBS_tan ( int angle )

This function calculates tangent without using float-point numbers.It use a constant table to look up for the appropriate value.

Parameters
 [in] angle angle=degrees*ANG_45DEG/45,degrees=angle*45/ANG_45DEG.
Returns
tan(degrees)*1024.
Generated by   1.8.9.1