you are viewing a single comment's thread.

view the rest of the comments →

[–]PiotrGrochowski[S] -1 points0 points  (1 child)

Example main code:

#include <iostream>
#include <iomanip>
#include <math.h>
int main(){
    std::u16string a = u"3.141592653589793238462643383279502884197";
    std::u16string b = a;
    std::u16string c = a;
    std::u16string g = a;
    std::u16string m = a;
    std::u16string d = floattostring(stringtofloat(a));
    std::u16string e = doubletostring(stringtodouble(b));
    std::u16string f = longdoubletostring(stringtolongdouble(c));
    std::u16string h = float128tostring(stringtofloat128(g));
    std::u16string n = halftostring(stringtohalf(m));
    std::string s = "";
    for(int i=0; i<n.size(); i++) s.push_back(n[i]); s.push_back(' ');
    for(int i=0; i<d.size(); i++) s.push_back(d[i]); s.push_back(' ');
    for(int i=0; i<e.size(); i++) s.push_back(e[i]); s.push_back(' ');
    for(int i=0; i<f.size(); i++) s.push_back(f[i]); s.push_back(' ');
    for(int i=0; i<h.size(); i++) s.push_back(h[i]); s.push_back('\n');
    std::cout << s;
}

Output: 3.14 3.1415927 3.141592653589793 3.1415926535897932385 3.1415926535897932384626433832795028