Timings for the Math Library--libm:
Using a GPS MAS281 Processor

Applies to: GCC-1750 Version 1.0.
Last updated: Friday May 03, 2002.

SUMMARY

The library libm is the ANSI standard math library. In GCC-1750 the math library is written as a number of C language files, some of which have assembly language inserts. Hardware floating point arithmetic is used where possible. In most cases libm uses extended precision floating point because in the C language, floating point operations default to the type ‘double’ and all the functions in libm take double arguments and return double results.

We ran the libm execution time tests on the 5MHz MAS281 target. We got the instruction counts using 1750 the simulator.

The results are presented in the following table:

Function call

Number of Instructions Executed

Execution Time in Microseconds

acos (0.5)

64

401

asin (0.5)

55

377

atan (0.5)

66

438

atan2 (1.0, 2.0)

98

491

ceil (1.5)

40

56

cos (1.0)

144

540

cosh (1.0)

170

574

exp (1.0)

149

460

fabs (1.0)

0

0

floor (1.5)

27

26

fmod (100.0, 3.0)

55

128

frexp (1024.0, &itmp)

12

16

ldexp (1.0, 10)

19

18

log (100.0)

70

415

log10 (100.0)

77

441

modf (1.5, &xtmp)

47

61

pow (10.0, 10.0)

357

1066

sin (1.0)

131

469

sinh (1.0)

39

233

sqrt (2.0)

72

317

tan (1.0)

191

556

tanh (1.0)

180

575

 
Updated May 11, 2005
Copyright XGC Software