Skip to content

Commit 3a0f7c5

Browse files
authored
Update example.c
Add const qualifier to x array Resolve style warning about variable declaration Signed-off-by: JaySoni1 <[email protected]>
1 parent ef90f52 commit 3a0f7c5

File tree

1 file changed

+12
-11
lines changed
  • lib/node_modules/@stdlib/number/float32/base/normalize/examples/c

1 file changed

+12
-11
lines changed

lib/node_modules/@stdlib/number/float32/base/normalize/examples/c/example.c

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,22 @@
1515
* See the License for the specific language governing permissions and
1616
* limitations under the License.
1717
*/
18-
1918
#include "stdlib/number/float32/base/normalize.h"
2019
#include <stdint.h>
2120
#include <stdio.h>
2221
#include <inttypes.h>
2322

2423
int main( void ) {
25-
float x[] = { 4.0f, 0.0f, -0.0f, 1.0f, -1.0f, 3.14f, -3.14f, 1.0e-38f, -1.0e-38f, 1.0f/0.0f, -1.0f/0.0f, 0.0f/0.0f };
26-
27-
int32_t exp;
28-
float y;
29-
int i;
30-
for ( i = 0; i < 12; i++ ) {
31-
stdlib_base_float32_normalize( x[ i ], &y, &exp );
32-
printf( "%f => y: %f, exp: %" PRId32 "\n", x[ i ], y, exp );
33-
}
34-
24+
// Declare the array as const to address the lint warning
25+
const float x[] = { 4.0f, 0.0f, -0.0f, 1.0f, -1.0f, 3.14f, -3.14f, 1.0e-38f, -1.0e-38f, 1.0f/0.0f, -1.0f/0.0f, 0.0f/0.0f };
26+
int32_t exp;
27+
float y;
28+
int i;
29+
30+
for ( i = 0; i < 12; i++ ) {
31+
stdlib_base_float32_normalize( x[ i ], &y, &exp );
32+
printf( "%f => y: %f, exp: %" PRId32 "\n", x[ i ], y, exp );
33+
}
34+
35+
return 0;
3536
}

0 commit comments

Comments
 (0)