blob: ccfc286898e54d5f91a62bf96e7675c0eb26ddf2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
/*=============================================================
**
** Source: _gcvt.c
**
** Purpose: Positive test the _gcvt API.
** Call _gcvt to convert a floatable value to a string
** with specified sigficant digits stored
**
**
**============================================================*/
#include <palsuite.h>
int __cdecl main(int argc, char *argv[])
{
int err;
double dValue = -3.1415926535;
char buffer[1024];
char *pChar7 = "-3.141593";
/*Initialize the PAL environment*/
err = PAL_Initialize(argc, argv);
if(0 != err)
{
return FAIL;
}
/* zero the buffer */
memset(buffer, 0, 1024);
/*
Testing
=======
To convert a floating-point value to
a string to save 7 significant digits
*/
_gcvt(dValue, 7, buffer);
if(strcmp(pChar7, buffer))
{
Fail("\nFailed to call _gcvt to convert a floating-point value "
"to a string with 7 sigficants digits stored\n");
}
/*
Clean up and exit
*/
PAL_Terminate();
return PASS;
}
|