aboutsummaryrefslogtreecommitdiff
path: root/src/float.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/float.cpp')
-rw-r--r--src/float.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/float.cpp b/src/float.cpp
index e69de29..e257b37 100644
--- a/src/float.cpp
+++ b/src/float.cpp
@@ -0,0 +1,37 @@
1#include "gats/float.h"
2#include "gats/integer.h"
3
4Gats::Float::Float() :
5 fVal( 0.0 )
6{
7}
8
9Gats::Float::Float( double f ) :
10 fVal( f )
11{
12}
13
14Gats::Float::~Float()
15{
16}
17
18void Gats::Float::write( Bu::Stream &rOut ) const
19{
20 char buf[50];
21
22 int iSize = snprintf( buf, 50, "%la", fVal );
23
24 rOut.write("f", 1 );
25 Gats::Integer::writePackedInt( rOut, iSize );
26 rOut.write( buf, iSize );
27}
28
29void Gats::Float::read( Bu::Stream &rIn, char cType )
30{
31 int iSize;
32 Gats::Integer::readPackedInt( rIn, iSize );
33 char buf[50];
34 rIn.read( buf, iSize );
35 sscanf( buf, "%la", &fVal );
36}
37