pike.git
/
src
/
operators.c
version
»
Context lines:
10
20
40
80
file
none
3
pike.git/src/operators.c:1:
/* || This file is part of Pike. For copyright information see COPYRIGHT. || Pike is distributed under GPL, LGPL and MPL. See the file COPYING || for more information.
-
|| $Id: operators.c,v 1.
253
2009/08/
12
14
:
44
:
02
grubba
Exp $
+
|| $Id: operators.c,v 1.
254
2009/08/
20
16
:
24
:
36
mast
Exp $
*/ #include "global.h" #include <math.h> #include "interpret.h" #include "svalue.h" #include "multiset.h" #include "mapping.h" #include "array.h" #include "stralloc.h"
pike.git/src/operators.c:479:
default: Pike_error("Cannot cast %s to string.\n", get_name_of_type(sp[-1].type)); case PIKE_T_STRING: return; case T_FLOAT: sprintf(buf,"%.*"PRINTPIKEFLOAT"g", PIKEFLOAT_DIG, sp[-1].u.float_number);
-
/*
Ensure
that
either
an
exponent or a decimal point gets printed,
-
* since %g can remove both which would make it look like an integer
. */
-
if (!
strchr
(buf, '.') && !
strchr
(buf, 'e'))
+
/*
Same
kludge
as
in
svalue
.
c:describe_svalue.
*/
+
if (!
STRCHR
(buf, '.') && !
STRCHR
(buf, '
,') && !STRCHR (buf, '
e'))
strcat (buf, ".0"); break; case T_INT: sprintf(buf, "%"PRINTPIKEINT"d", sp[-1].u.integer); break; } sp[-1].type = PIKE_T_STRING; sp[-1].u.string = make_shared_string(buf);