// joycub V2 - an interpeter for the programming language Joy
// (c) 2004-2006 Sergey Zubkov 
// prototype.cc - prototype module to test out the new design considerations
static char RCSID[] ="$Id: float.cc,v 1.1 2006/02/27 18:50:34 cubbi Exp cubbi $";

#include <iostream>
#include <sstream>
#include "float.h"

// global object counters (for memory debugging)
int float_type_count = 0;

JC_float::JC_float(double f) : content(f) {
	float_type_count++;
};

JC_float::JC_float(const std::string& s) {
	float_type_count++;
	content = atof(s.c_str());
}

JC_float::JC_float(const JC_float& j) {
	float_type_count++;
	content = j.content;
};

JC_float::~JC_float(void) {
	float_type_count--;
};

const obj_type JC_float::get_type(void) const {
	return FLOAT;
};

std::string JC_float::to_string(void) const {
	std::ostringstream s;
//	s << content << ":" << ref_count;
	s << content;
	return s.str();
}
void JC_float::debug_print(void) const {
	std::cout << to_string();
};

std::string JC_float::key(void) const { 
	std::ostringstream tmp_string;
	tmp_string << content;
	return tmp_string.str();
};

double JC_float::to_double(void) const{
	return content;
}
