1
/////////////////////////////////////////////////////////////////////////
4
// Copyright (c) 1996 Bryce W. Harrington - bryce@neptune.net
6
//-----------------------------------------------------------------------
7
// License: This code may be used by anyone for any purpose
8
// so long as the copyright notices and this license
9
// statement remains attached.
10
//-----------------------------------------------------------------------
11
// Description of file contents
12
// 1993 - Bryce Harrington
13
// Created initial ftoa routine
15
// October 1996 - Bryce Harrington
16
// Created itos from code taken from Kernighan & Ritchie
17
// _The C Programming Language_ 2nd edition
19
// November 1996 - Bryce Harrington
20
// Created new ftoa and ftos
22
// July 1999 - Bryce Harrington
23
// Ported to Linux for use in WorldForge
25
// January 2000 - Karsten Laux klaux@rhrk.uni-kl.de
26
// added ultos - convering ulong to string
28
/////////////////////////////////////////////////////////////////////////
35
const int FORCE_X10 = (1 << 0);
36
const int FORCE_DECIMAL = (1 << 1);
37
const int FORCE_EXP_ZERO = (1 << 2);
38
const int FORCE_HUNDRED_EXP_ZERO = (1 << 3);
39
const int FORCE_EXP_PLUS = (1 << 4);
40
const int FORCE_EXP = (1 << 5);
41
const int FORCE_PLUS = (1 << 6);
44
std::string ftos(double val, char mode='g', int sigfig=-1, int precision=-1, int options=0);
46
std::string itos(int n);
48
std::string ultos(unsigned long n);
50
double rround(double x); // use rounding rule -> x to nearest int.
52
double rround(double x, int k); // round to the kth place