do you have plans to implement trigonometric functions like sin(), cos(), tan() etc. ?

Best regards

Ettl Martin

Added by: tomek, 2010 IX 05

they are defined but only for Big<> objects, sample:

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

using namespace ttmath;

int main()
{
Big<1, 3> a = "123.456";

std::cout << Sin(a) << std::endl;
std::cout << Cos(a) << std::endl;
std::cout << Tan(a) << std::endl;
std::cout << Ctg(a) << std::endl;
}

Added by: ~guest, 2010 IX 08

Oh, great!

Thanks for the sample!!

Added by: ~guest, 2010 IX 26

Is there a reason why you have this special name convention for trigonometric functions that differ from the well known from math.h.
e.g. in math.h the tangens is declared as tan(). In ttmath the tangens is declared as Tan().

Added by: tomek, 2010 IX 28

All functions/methods in ttmath begin with a capital letter.

Added by: ~guest, 2010 X 09

Yes, exactly. This was my question! Why does the function name start with capital letters? In other words, why break with the normally used names from <math.h> and writing Sin() instead of sin()? Is there any reason for that, or just some design rule convention?

Added by: tomek, 2010 X 14, Last modified: 2010 X 14

There is not a special reason. I think about giving wrappers:
Sin(x) -> sin(x)
object.Log(y) -> object.log(y)
object.LongName(y) -> object.long_name(y)

I noticed that people prefer the latter way.

Added by: ~guest, 2010 X 14

Wrappers are good. I think the best way is to stay as compatible as possible to the functions that allready exist in math.h ... This makes it easier to switch between multiprecision and standard datatypes like double.

Best regards

Added by: ~Martin Ettl, 2010 XI 22

here are some wrappers for trigonometric functions i have created to stay closer to the C-standardlibrary names:

template<class ValueType> ValueType sin (const ValueType &x){return ttmath::Sin(x);}
template<class ValueType> ValueType cos (const ValueType &x){return ttmath::Cos(x);}
template<class ValueType> ValueType tan (const ValueType &x){return ttmath::Tan(x);}
template<class ValueType> ValueType asin (const ValueType &x){return ttmath::ASin(x);}
template<class ValueType> ValueType acos (const ValueType &x){return ttmath::ACos(x);}
template<class ValueType> ValueType atan (const ValueType &x){return ttmath::ATan(x);}
template<class ValueType> ValueType sqrt (const ValueType &x){return ttmath::Sqrt(x);}

Best regards

Martin

Added by: tomek, 2010 XII 07

thanks, will be added soon