### ----------------------------------------------------
### -- Rat::Precise
### -- Licenses: Artistic-2.0
### -- Authors: Steve Schulze (thundergnat)
### -- File: t/02-fatrat.t
### ----------------------------------------------------
### -- Chunk 1 of 2
use Test;
use Rat::Precise;

plan 216;

can-ok( FatRat, 'precise', 'FatRat can .precise');

# Testing terminating powers of 2 denominator

is(FatRat.new( 1,2**0).precise, '1', 'Testing FatRat .5**0');
is(FatRat.new( 1,2**1).precise, '0.5', 'Testing FatRat .5**1');
is(FatRat.new( 1,2**2).precise, '0.25', 'Testing FatRat .5**2');
is(FatRat.new( 1,2**3).precise, '0.125', 'Testing FatRat .5**3');
is(FatRat.new( 1,2**4).precise, '0.0625', 'Testing FatRat .5**4');
is(FatRat.new( 1,2**5).precise, '0.03125', 'Testing FatRat .5**5');
is(FatRat.new( 1,2**6).precise, '0.015625', 'Testing FatRat .5**6');
is(FatRat.new( 1,2**7).precise, '0.0078125', 'Testing FatRat .5**7');
is(FatRat.new( 1,2**8).precise, '0.00390625', 'Testing FatRat .5**8');
is(FatRat.new( 1,2**9).precise, '0.001953125', 'Testing FatRat .5**9');
is(FatRat.new(1,2**10).precise, '0.0009765625', 'Testing FatRat .5**10');
is(FatRat.new(1,2**11).precise, '0.00048828125', 'Testing FatRat .5**11');
is(FatRat.new(1,2**12).precise, '0.000244140625', 'Testing FatRat .5**12');
is(FatRat.new(1,2**13).precise, '0.0001220703125', 'Testing FatRat .5**13');
is(FatRat.new(1,2**14).precise, '0.00006103515625', 'Testing FatRat .5**14');
is(FatRat.new(1,2**15).precise, '0.000030517578125', 'Testing FatRat .5**15');
is(FatRat.new(1,2**16).precise, '0.0000152587890625', 'Testing FatRat .5**16');
is(FatRat.new(1,2**17).precise, '0.00000762939453125', 'Testing FatRat .5**17');
is(FatRat.new(1,2**18).precise, '0.000003814697265625', 'Testing FatRat .5**18');
is(FatRat.new(1,2**19).precise, '0.0000019073486328125', 'Testing FatRat .5**19');
is(FatRat.new(1,2**20).precise, '0.00000095367431640625', 'Testing FatRat .5**20');
is(FatRat.new(1,2**21).precise, '0.000000476837158203125', 'Testing FatRat .5**21');
is(FatRat.new(1,2**22).precise, '0.0000002384185791015625', 'Testing FatRat .5**22');
is(FatRat.new(1,2**23).precise, '0.00000011920928955078125', 'Testing FatRat .5**23');
is(FatRat.new(1,2**24).precise, '0.000000059604644775390625', 'Testing FatRat .5**24');
is(FatRat.new(1,2**25).precise, '0.0000000298023223876953125', 'Testing FatRat .5**25');
is(FatRat.new(1,2**26).precise, '0.00000001490116119384765625', 'Testing FatRat .5**26');
is(FatRat.new(1,2**27).precise, '0.000000007450580596923828125', 'Testing FatRat .5**27');
is(FatRat.new(1,2**28).precise, '0.0000000037252902984619140625', 'Testing FatRat .5**28');
is(FatRat.new(1,2**29).precise, '0.00000000186264514923095703125', 'Testing FatRat .5**29');
is(FatRat.new(1,2**30).precise, '0.000000000931322574615478515625', 'Testing FatRat .5**30');
is(FatRat.new(1,2**31).precise, '0.0000000004656612873077392578125', 'Testing FatRat .5**31');
is(FatRat.new(1,2**32).precise, '0.00000000023283064365386962890625', 'Testing FatRat .5**32');
is(FatRat.new(1,2**33).precise, '0.000000000116415321826934814453125', 'Testing FatRat .5**33');
is(FatRat.new(1,2**34).precise, '0.0000000000582076609134674072265625', 'Testing FatRat .5**34');
is(FatRat.new(1,2**35).precise, '0.00000000002910383045673370361328125', 'Testing FatRat .5**35');
is(FatRat.new(1,2**36).precise, '0.000000000014551915228366851806640625', 'Testing FatRat .5**36');
is(FatRat.new(1,2**37).precise, '0.0000000000072759576141834259033203125', 'Testing FatRat .5**37');
is(FatRat.new(1,2**38).precise, '0.00000000000363797880709171295166015625', 'Testing FatRat .5**38');
is(FatRat.new(1,2**39).precise, '0.000000000001818989403545856475830078125', 'Testing FatRat .5**39');
is(FatRat.new(1,2**40).precise, '0.0000000000009094947017729282379150390625', 'Testing FatRat .5**40');
is(FatRat.new(1,2**41).precise, '0.00000000000045474735088646411895751953125', 'Testing FatRat .5**41');
is(FatRat.new(1,2**42).precise, '0.000000000000227373675443232059478759765625', 'Testing FatRat .5**42');
is(FatRat.new(1,2**43).precise, '0.0000000000001136868377216160297393798828125', 'Testing FatRat .5**43');
is(FatRat.new(1,2**44).precise, '0.00000000000005684341886080801486968994140625', 'Testing FatRat .5**44');
is(FatRat.new(1,2**45).precise, '0.000000000000028421709430404007434844970703125', 'Testing FatRat .5**45');
is(FatRat.new(1,2**46).precise, '0.0000000000000142108547152020037174224853515625', 'Testing FatRat .5**46');
is(FatRat.new(1,2**47).precise, '0.00000000000000710542735760100185871124267578125', 'Testing FatRat .5**47');
is(FatRat.new(1,2**48).precise, '0.000000000000003552713678800500929355621337890625', 'Testing FatRat .5**48');
is(FatRat.new(1,2**49).precise, '0.0000000000000017763568394002504646778106689453125', 'Testing FatRat .5**49');
is(FatRat.new(1,2**50).precise, '0.00000000000000088817841970012523233890533447265625', 'Testing FatRat .5**50');
is(FatRat.new(1,2**51).precise, '0.000000000000000444089209850062616169452667236328125', 'Testing FatRat .5**51');
is(FatRat.new(1,2**52).precise, '0.0000000000000002220446049250313080847263336181640625', 'Testing FatRat .5**52');
is(FatRat.new(1,2**53).precise, '0.00000000000000011102230246251565404236316680908203125', 'Testing FatRat .5**53');
is(FatRat.new(1,2**54).precise, '0.000000000000000055511151231257827021181583404541015625', 'Testing FatRat .5**54');
is(FatRat.new(1,2**55).precise, '0.0000000000000000277555756156289135105907917022705078125', 'Testing FatRat .5**55');
is(FatRat.new(1,2**56).precise, '0.00000000000000001387778780781445675529539585113525390625', 'Testing FatRat .5**56');
is(FatRat.new(1,2**57).precise, '0.000000000000000006938893903907228377647697925567626953125', 'Testing FatRat .5**57');
is(FatRat.new(1,2**58).precise, '0.0000000000000000034694469519536141888238489627838134765625', 'Testing FatRat .5**58');
is(FatRat.new(1,2**59).precise, '0.00000000000000000173472347597680709441192448139190673828125', 'Testing FatRat .5**59');
is(FatRat.new(1,2**60).precise, '0.000000000000000000867361737988403547205962240695953369140625', 'Testing FatRat .5**60');
is(FatRat.new(1,2**61).precise, '0.0000000000000000004336808689942017736029811203479766845703125', 'Testing FatRat .5**61');
is(FatRat.new(1,2**62).precise, '0.00000000000000000021684043449710088680149056017398834228515625', 'Testing FatRat .5**62');
is(FatRat.new(1,2**63).precise, '0.000000000000000000108420217248550443400745280086994171142578125', 'Testing FatRat .5**63');
is(FatRat.new(1,2**64).precise, '0.0000000000000000000542101086242752217003726400434970855712890625', 'Testing FatRat .5**64');
is(FatRat.new(1,2**65).precise, '0.00000000000000000002710505431213761085018632002174854278564453125', 'Testing FatRat .5**65');
is(FatRat.new(1,2**66).precise, '0.000000000000000000013552527156068805425093160010874271392822265625', 'Testing FatRat .5**66');
is(FatRat.new(1,2**67).precise, '0.0000000000000000000067762635780344027125465800054371356964111328125', 'Testing FatRat .5**67');
is(FatRat.new(1,2**68).precise, '0.00000000000000000000338813178901720135627329000271856784820556640625', 'Testing FatRat .5**68');
is(FatRat.new(1,2**69).precise, '0.000000000000000000001694065894508600678136645001359283924102783203125', 'Testing FatRat .5**69');
is(FatRat.new(1,2**70).precise, '0.0000000000000000000008470329472543003390683225006796419620513916015625', 'Testing FatRat .5**70');
is(FatRat.new(1,2**71).precise, '0.00000000000000000000042351647362715016953416125033982098102569580078125', 'Testing FatRat .5**71');
is(FatRat.new(1,2**72).precise, '0.000000000000000000000211758236813575084767080625169910490512847900390625', 'Testing FatRat .5**72');
is(FatRat.new(1,2**73).precise, '0.0000000000000000000001058791184067875423835403125849552452564239501953125', 'Testing FatRat .5**73');
is(FatRat.new(1,2**74).precise, '0.00000000000000000000005293955920339377119177015629247762262821197509765625', 'Testing FatRat .5**74');
is(FatRat.new(1,2**75).precise, '0.000000000000000000000026469779601696885595885078146238811314105987548828125', 'Testing FatRat .5**75');
is(FatRat.new(1,2**76).precise, '0.0000000000000000000000132348898008484427979425390731194056570529937744140625', 'Testing FatRat .5**76');
is(FatRat.new(1,2**77).precise, '0.00000000000000000000000661744490042422139897126953655970282852649688720703125', 'Testing FatRat .5**77');
is(FatRat.new(1,2**78).precise, '0.000000000000000000000003308722450212110699485634768279851414263248443603515625', 'Testing FatRat .5**78');
is(FatRat.new(1,2**79).precise, '0.0000000000000000000000016543612251060553497428173841399257071316242218017578125', 'Testing FatRat .5**79');
is(FatRat.new(1,2**80).precise, '0.00000000000000000000000082718061255302767487140869206996285356581211090087890625', 'Testing FatRat .5**80');
is(FatRat.new(1,2**81).precise, '0.000000000000000000000000413590306276513837435704346034981426782906055450439453125', 'Testing FatRat .5**81');
is(FatRat.new(1,2**82).precise, '0.0000000000000000000000002067951531382569187178521730174907133914530277252197265625', 'Testing FatRat .5**82');
is(FatRat.new(1,2**83).precise, '0.00000000000000000000000010339757656912845935892608650874535669572651386260986328125', 'Testing FatRat .5**83');
is(FatRat.new(1,2**84).precise, '0.000000000000000000000000051698788284564229679463043254372678347863256931304931640625', 'Testing FatRat .5**84');
is(FatRat.new(1,2**85).precise, '0.0000000000000000000000000258493941422821148397315216271863391739316284656524658203125', 'Testing FatRat .5**85');
is(FatRat.new(1,2**86).precise, '0.00000000000000000000000001292469707114105741986576081359316958696581423282623291015625', 'Testing FatRat .5**86');
is(FatRat.new(1,2**87).precise, '0.000000000000000000000000006462348535570528709932880406796584793482907116413116455078125', 'Testing FatRat .5**87');
is(FatRat.new(1,2**88).precise, '0.0000000000000000000000000032311742677852643549664402033982923967414535582065582275390625', 'Testing FatRat .5**88');
is(FatRat.new(1,2**89).precise, '0.00000000000000000000000000161558713389263217748322010169914619837072677910327911376953125', 'Testing FatRat .5**89');
is(FatRat.new(1,2**90).precise, '0.000000000000000000000000000807793566946316088741610050849573099185363389551639556884765625', 'Testing FatRat .5**90');

# Testing terminating powers of 5 denominator

is(FatRat.new(1, 5**1).precise, '0.2', 'Testing FatRat .2**1');
is(FatRat.new(1, 5**2).precise, '0.04', 'Testing FatRat .2**2');
is(FatRat.new(1, 5**3).precise, '0.008', 'Testing FatRat .2**3');
is(FatRat.new(1, 5**4).precise, '0.0016', 'Testing FatRat .2**4');
is(FatRat.new(1, 5**5).precise, '0.00032', 'Testing FatRat .2**5');
is(FatRat.new(1, 5**6).precise, '0.000064', 'Testing FatRat .2**6');
is(FatRat.new(1, 5**7).precise, '0.0000128', 'Testing FatRat .2**7');
is(FatRat.new(1, 5**8).precise, '0.00000256', 'Testing FatRat .2**8');
is(FatRat.new(1, 5**9).precise, '0.000000512', 'Testing FatRat .2**9');
is(FatRat.new(1,5**10).precise, '0.0000001024', 'Testing FatRat .2**10');
is(FatRat.new(1,5**11).precise, '0.00000002048', 'Testing FatRat .2**11');
is(FatRat.new(1,5**12).precise, '0.000000004096', 'Testing FatRat .2**12');
is(FatRat.new(1,5**13).precise, '0.0000000008192', 'Testing FatRat .2**13');
is(FatRat.new(1,5**14).precise, '0.00000000016384', 'Testing FatRat .2**14');
is(FatRat.new(1,5**15).precise, '0.000000000032768', 'Testing FatRat .2**15');
is(FatRat.new(1,5**16).precise, '0.0000000000065536', 'Testing FatRat .2**16');
is(FatRat.new(1,5**17).precise, '0.00000000000131072', 'Testing FatRat .2**17');
is(FatRat.new(1,5**18).precise, '0.000000000000262144', 'Testing FatRat .2**18');
is(FatRat.new(1,5**19).precise, '0.0000000000000524288', 'Testing FatRat .2**19');
is(FatRat.new(1,5**20).precise, '0.00000000000001048576', 'Testing FatRat .2**20');
is(FatRat.new(1,5**21).precise, '0.000000000000002097152', 'Testing FatRat .2**21');
is(FatRat.new(1,5**22).precise, '0.0000000000000004194304', 'Testing FatRat .2**22');
is(FatRat.new(1,5**23).precise, '0.00000000000000008388608', 'Testing FatRat .2**23');
is(FatRat.new(1,5**24).precise, '0.000000000000000016777216', 'Testing FatRat .2**24');
is(FatRat.new(1,5**25).precise, '0.00000