bool Big::IsNan() - returns true if the NaN flag is set void Big::SetNan() - sets the NaN flag The NaN flag is set by default after creating an object: Big<1, 2> a; // NaN is set (it means the object has not a valid number) std::cout << a; // cout gives "NaN" a = 123; // now NaN is not set std::cout << a; // cout gives "123" The NaN is set if there was a carry during calculations a.Mul(very_big_value); // a will have a NaN set The NaN is set if an argument is NaN too b.SetNan(); a.Add(b); // a will have NaN because b has NaN too If you try to do something on a NaN object, the result is a NaN too a.SetNan(); a.Add(2); // a is still a NaN The NaN is set if you use incorrect arguments a.Ln(-10); // a will have the NaN flag The only way to clear the NaN flag is to assign a correct value or other correct object supposing 'a' has NaN flag, to remove the flag you can either: a = 10; a.FromInt(30); a.SetOne(); a.FromBig(other_object_without_nan); etc. changed: renamed macro CONSTANTSGENERATOR to TTMATH_CONSTANTSGENERATOR git-svn-id: svn://ttmath.org/publicrep/ttmath/trunk@152 e52654a7-88a9-db11-a3e9-0013d4bc506e
28 lines
287 B
Makefile
28 lines
287 B
Makefile
o = main.o
|
|
CC = g++
|
|
CFLAGS = -s -O2 -DTTMATH_CONSTANTSGENERATOR
|
|
name = gen
|
|
|
|
|
|
.SUFFIXES: .cpp .o
|
|
|
|
.cpp.o:
|
|
$(CC) -c $(CFLAGS) $<
|
|
|
|
|
|
all: $(name)
|
|
|
|
$(name): $(o)
|
|
$(CC) -o $(name) $(CFLAGS) $(o)
|
|
|
|
|
|
|
|
main.o: main.cpp
|
|
|
|
|
|
clean:
|
|
rm -f *.o
|
|
rm -f *.s
|
|
rm -f $(name)
|
|
rm -f $(name).exe
|