## how to do Sin? ( high precision )

in online calculator:

sin(47165.12252593838) -> -0.38205373176**570**196927678559125829662822819072674679657 5333636...

in a copy of sample Big.cpp - to have the environment - acc. to 'how to do squareroot?'

a = 47165.12252593838;
a.Sin();
std::cout << std::setprecision( 25 ) << a << std::endl;

make ->
sinlist.cpp: In function ‘int main()’:
sinlist.cpp:845:3: error: ‘MyBig’ {aka ‘class ttmath::Big<1, 2>’} has no member named ‘Sin’; did you mean ‘Sgn’?
845 | a.Sin();

other attempts with e.g. Sin( a ) -> other errors, at best 'Sin( a ) = -0.38205373176**488**19160662843485353044268', low ( double? ) precision result.

TIA for any help, I'm not a pro(grammer), just need a list of references which is too long to produce with the online calculator ...

Added by: tomek, 2022 VI 22, Last modified: 2022 VI 22

Use global Sin method from ttmath namespace:

a = 47165.12252593838;
std::cout << ttmath::Sin(a) << std::endl;

Also std::setprecision do not work with ttmath, use Conv struct for formating, sample:

#include <iostream>
#include "ttmath/ttmath.h"

// Big<exponent, mantissa>
typedef ttmath::Big<1,2> MyBig;

int main()
{
MyBig a,b;
ttmath::Conv conv;
std::string res;

a = 47165.12252593838;
b = ttmath::Sin(a);
conv.trim_zeroes = false;
conv.group = '`';
res = b.ToString(conv);

std::cout << res << std::endl;
}

Output:
-0.382`053`731`764`881`916`066`284`348`535`304`426`8