Rev 2 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2 | Rev 5 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | /* ---------------------------------------------------------------------- |
1 | /* ---------------------------------------------------------------------- |
2 | * Copyright (C) 2010-2014 ARM Limited. All rights reserved. |
2 | * Copyright (C) 2010-2014 ARM Limited. All rights reserved. |
3 | * |
3 | * |
4 | * $Date: 19. March 2015 |
4 | * $Date: 19. October 2015 |
5 | * $Revision: V.1.4.5 |
5 | * $Revision: V.1.4.5 a |
6 | * |
6 | * |
7 | * Project: CMSIS DSP Library |
7 | * Project: CMSIS DSP Library |
8 | * Title: arm_sqrt_q15.c |
8 | * Title: arm_sqrt_q15.c |
9 | * |
9 | * |
10 | * Description: Q15 square root function. |
10 | * Description: Q15 square root function. |
Line 92... | Line 92... | ||
92 | /* Calculate half value of the number */ |
92 | /* Calculate half value of the number */ |
93 | half = number >> 1; |
93 | half = number >> 1; |
94 | /* Store the number for later use */ |
94 | /* Store the number for later use */ |
95 | temp1 = number; |
95 | temp1 = number; |
96 | 96 | ||
97 | /*Convert to float */ |
97 | /* Convert to float */ |
98 | temp_float1 = number * 3.051757812500000e-005f; |
98 | temp_float1 = number * 3.051757812500000e-005f; |
99 | /*Store as integer */ |
99 | /*Store as integer */ |
100 | tempconv.floatval = temp_float1; |
100 | tempconv.floatval = temp_float1; |
101 | bits_val1 = tempconv.fracval; |
101 | bits_val1 = tempconv.fracval; |
102 | /* Subtract the shifted value from the magic number to give intial guess */ |
102 | /* Subtract the shifted value from the magic number to give intial guess */ |
103 | bits_val1 = 0x5f3759df - (bits_val1 >> 1); // gives initial guess |
103 | bits_val1 = 0x5f3759df - (bits_val1 >> 1); /* gives initial guess */ |
104 | /* Store as float */ |
104 | /* Store as float */ |
105 | tempconv.fracval = bits_val1; |
105 | tempconv.fracval = bits_val1; |
106 | temp_float1 = tempconv.floatval; |
106 | temp_float1 = tempconv.floatval; |
107 | /* Convert to integer format */ |
107 | /* Convert to integer format */ |
108 | var1 = (q31_t) (temp_float1 * 16384); |
108 | var1 = (q31_t) (temp_float1 * 16384); |