Files
MP-SPDZ/Processor/FloatInput.cpp
2019-07-11 14:59:18 +10:00

24 lines
390 B
C++

/*
* FloatInput.cpp
*
*/
#include "FloatInput.h"
#include <math.h>
const char* FloatInput::NAME = "real number";
void FloatInput::read(std::istream& in, const int* params)
{
double x;
in >> x;
int exp;
double mant = fabs(frexp(x, &exp));
items[0] = round(mant * (1LL << *params));
items[1] = exp - *params;
items[2] = (x == 0);
items[3] = (x < 0);
}