### ----------------------------------------------------
### -- Rat::Precise
### -- Licenses: Artistic-2.0
### -- Authors: Steve Schulze (thundergnat)
### -- File: t/02-fatrat.t
### ----------------------------------------------------
### -- Chunk 2 of 2
00000000000033554432', 'Testing FatRat .2**25');
is(FatRat.new(1,5**26).precise, '0.00000000000000000067108864', 'Testing FatRat .2**26');
is(FatRat.new(1,5**27).precise, '0.000000000000000000134217728', 'Testing FatRat .2**27');
is(FatRat.new(1,5**28).precise, '0.0000000000000000000268435456', 'Testing FatRat .2**28');
is(FatRat.new(1,5**29).precise, '0.00000000000000000000536870912', 'Testing FatRat .2**29');
is(FatRat.new(1,5**30).precise, '0.000000000000000000001073741824', 'Testing FatRat .2**30');
is(FatRat.new(1,5**31).precise, '0.0000000000000000000002147483648', 'Testing FatRat .2**31');
is(FatRat.new(1,5**32).precise, '0.00000000000000000000004294967296', 'Testing FatRat .2**32');
is(FatRat.new(1,5**33).precise, '0.000000000000000000000008589934592', 'Testing FatRat .2**33');
is(FatRat.new(1,5**34).precise, '0.0000000000000000000000017179869184', 'Testing FatRat .2**34');
is(FatRat.new(1,5**35).precise, '0.00000000000000000000000034359738368', 'Testing FatRat .2**35');
is(FatRat.new(1,5**36).precise, '0.000000000000000000000000068719476736', 'Testing FatRat .2**36');
is(FatRat.new(1,5**37).precise, '0.0000000000000000000000000137438953472', 'Testing FatRat .2**37');
is(FatRat.new(1,5**38).precise, '0.00000000000000000000000000274877906944', 'Testing FatRat .2**38');
is(FatRat.new(1,5**39).precise, '0.000000000000000000000000000549755813888', 'Testing FatRat .2**39');
is(FatRat.new(1,5**40).precise, '0.0000000000000000000000000001099511627776', 'Testing FatRat .2**40');
is(FatRat.new(1,5**41).precise, '0.00000000000000000000000000002199023255552', 'Testing FatRat .2**41');
is(FatRat.new(1,5**42).precise, '0.000000000000000000000000000004398046511104', 'Testing FatRat .2**42');
is(FatRat.new(1,5**43).precise, '0.0000000000000000000000000000008796093022208', 'Testing FatRat .2**43');
is(FatRat.new(1,5**44).precise, '0.00000000000000000000000000000017592186044416', 'Testing FatRat .2**44');
is(FatRat.new(1,5**45).precise, '0.000000000000000000000000000000035184372088832', 'Testing FatRat .2**45');
is(FatRat.new(1,5**46).precise, '0.0000000000000000000000000000000070368744177664', 'Testing FatRat .2**46');
is(FatRat.new(1,5**47).precise, '0.00000000000000000000000000000000140737488355328', 'Testing FatRat .2**47');
is(FatRat.new(1,5**48).precise, '0.000000000000000000000000000000000281474976710656', 'Testing FatRat .2**48');
is(FatRat.new(1,5**49).precise, '0.0000000000000000000000000000000000562949953421312', 'Testing FatRat .2**49');
is(FatRat.new(1,5**50).precise, '0.00000000000000000000000000000000001125899906842624', 'Testing FatRat .2**50');
is(FatRat.new(1,5**51).precise, '0.000000000000000000000000000000000002251799813685248', 'Testing FatRat .2**51');
is(FatRat.new(1,5**52).precise, '0.0000000000000000000000000000000000004503599627370496', 'Testing FatRat .2**52');
is(FatRat.new(1,5**53).precise, '0.00000000000000000000000000000000000009007199254740992', 'Testing FatRat .2**53');
is(FatRat.new(1,5**54).precise, '0.000000000000000000000000000000000000018014398509481984', 'Testing FatRat .2**54');
is(FatRat.new(1,5**55).precise, '0.0000000000000000000000000000000000000036028797018963968', 'Testing FatRat .2**55');
is(FatRat.new(1,5**56).precise, '0.00000000000000000000000000000000000000072057594037927936', 'Testing FatRat .2**56');
is(FatRat.new(1,5**57).precise, '0.000000000000000000000000000000000000000144115188075855872', 'Testing FatRat .2**57');
is(FatRat.new(1,5**58).precise, '0.0000000000000000000000000000000000000000288230376151711744', 'Testing FatRat .2**58');
is(FatRat.new(1,5**59).precise, '0.00000000000000000000000000000000000000000576460752303423488', 'Testing FatRat .2**59');
is(FatRat.new(1,5**60).precise, '0.000000000000000000000000000000000000000001152921504606846976', 'Testing FatRat .2**60');
is(FatRat.new(1,5**61).precise, '0.0000000000000000000000000000000000000000002305843009213693952', 'Testing FatRat .2**61');
is(FatRat.new(1,5**62).precise, '0.00000000000000000000000000000000000000000004611686018427387904', 'Testing FatRat .2**62');
is(FatRat.new(1,5**63).precise, '0.000000000000000000000000000000000000000000009223372036854775808', 'Testing FatRat .2**63');
is(FatRat.new(1,5**64).precise, '0.0000000000000000000000000000000000000000000018446744073709551616', 'Testing FatRat .2**64');



is(FatRat.new( 1,1).precise(45), '1', 'Testing digits parameter 1/1');
is(FatRat.new( 1,2).precise(45), '0.5', 'Testing digits parameter 1/2');
is(FatRat.new( 1,3).precise(45), '0.333333333333333333333333333333333333333333333', 'Testing digits parameter 1/3');
is(FatRat.new( 1,4).precise(45), '0.25', 'Testing digits parameter 1/4');
is(FatRat.new( 1,5).precise(45), '0.2', 'Testing digits parameter 1/5');
is(FatRat.new( 1,6).precise(45), '0.166666666666666666666666666666666666666666667', 'Testing digits parameter 1/6');
is(FatRat.new( 1,7).precise(45), '0.142857142857142857142857142857142857142857143', 'Testing digits parameter 1/7');
is(FatRat.new( 1,8).precise(45), '0.125', 'Testing digits parameter 1/8');
is(FatRat.new( 1,9).precise(45), '0.111111111111111111111111111111111111111111111', 'Testing digits parameter 1/9');
is(FatRat.new(1,10).precise(45), '0.1', 'Testing digits parameter 1/10');
is(FatRat.new(1,11).precise(45), '0.090909090909090909090909090909090909090909091', 'Testing digits parameter 1/11');
is(FatRat.new(1,12).precise(45), '0.083333333333333333333333333333333333333333333', 'Testing digits parameter 1/12');
is(FatRat.new(1,13).precise(45), '0.076923076923076923076923076923076923076923077', 'Testing digits parameter 1/13');
is(FatRat.new(1,14).precise(45), '0.071428571428571428571428571428571428571428571', 'Testing digits parameter 1/14');
is(FatRat.new(1,15).precise(45), '0.066666666666666666666666666666666666666666667', 'Testing digits parameter 1/15');
is(FatRat.new(1,16).precise(45), '0.0625', 'Testing digits parameter 1/16');
is(FatRat.new(1,17).precise(45), '0.058823529411764705882352941176470588235294118', 'Testing digits parameter 1/17');
is(FatRat.new(1,18).precise(45), '0.055555555555555555555555555555555555555555556', 'Testing digits parameter 1/18');
is(FatRat.new(1,19).precise(45), '0.052631578947368421052631578947368421052631579', 'Testing digits parameter 1/19');
is(FatRat.new(1,20).precise(45), '0.05', 'Testing digits parameter 1/20');
is(FatRat.new(1,21).precise(45), '0.047619047619047619047619047619047619047619048', 'Testing digits parameter 1/21');
is(FatRat.new(1,22).precise(45), '0.045454545454545454545454545454545454545454545', 'Testing digits parameter 1/22');
is(FatRat.new(1,23).precise(45), '0.04347826086956521739130434782608695652173913', 'Testing digits parameter 1/23');
is(FatRat.new(1,24).precise(45), '0.041666666666666666666666666666666666666666667', 'Testing digits parameter 1/24');
is(FatRat.new(1,25).precise(45), '0.04', 'Testing digits parameter 1/25');


is(FatRat.new( 1,1).precise(45, :z), '1.000000000000000000000000000000000000000000000', 'Testing digits with :z flag parameter 1/1');
is(FatRat.new( 1,2).precise(45, :z), '0.500000000000000000000000000000000000000000000', 'Testing digits with :z flag parameter 1/2');
is(FatRat.new( 1,3).precise(45, :z), '0.333333333333333333333333333333333333333333333', 'Testing digits with :z flag parameter 1/3');
is(FatRat.new( 1,4).precise(45, :z), '0.250000000000000000000000000000000000000000000', 'Testing digits with :z flag parameter 1/4');
is(FatRat.new( 1,5).precise(45, :z), '0.200000000000000000000000000000000000000000000', 'Testing digits with :z flag parameter 1/5');
is(FatRat.new( 1,6).precise(45, :z), '0.166666666666666666666666666666666666666666667', 'Testing digits with :z flag parameter 1/6');
is(FatRat.new( 1,7).precise(45, :z), '0.142857142857142857142857142857142857142857143', 'Testing digits with :z flag parameter 1/7');
is(FatRat.new( 1,8).precise(45, :z), '0.125000000000000000000000000000000000000000000', 'Testing digits with :z flag parameter 1/8');
is(FatRat.new( 1,9).precise(45, :z), '0.111111111111111111111111111111111111111111111', 'Testing digits with :z flag parameter 1/9');
is(FatRat.new(1,10).precise(45 ,:z), '0.100000000000000000000000000000000000000000000', 'Testing digits with :z flag parameter 1/10');
is(FatRat.new(1,11).precise(45, :z), '0.090909090909090909090909090909090909090909091', 'Testing digits with :z flag parameter 1/11');
is(FatRat.new(1,12).precise(45, :z), '0.083333333333333333333333333333333333333333333', 'Testing digits with :z flag parameter 1/12');
is(FatRat.new(1,13).precise(45, :z), '0.076923076923076923076923076923076923076923077', 'Testing digits with :z flag parameter 1/13');
is(FatRat.new(1,14).precise(45, :z), '0.071428571428571428571428571428571428571428571', 'Testing digits with :z flag parameter 1/14');
is(FatRat.new(1,15).precise(45, :z), '0.066666666666666666666666666666666666666666667', 'Testing digits with :z flag parameter 1/15');
is(FatRat.new(1,16).precise(45, :z), '0.062500000000000000000000000000000000000000000', 'Testing digits with :z flag parameter 1/16');
is(FatRat.new(1,17).precise(45, :z), '0.058823529411764705882352941176470588235294118', 'Testing digits with :z flag parameter 1/17');
is(FatRat.new(1,18).precise(45, :z), '0.055555555555555555555555555555555555555555556', 'Testing digits with :z flag parameter 1/18');
is(FatRat.new(1,19).precise(45, :z), '0.052631578947368421052631578947368421052631579', 'Testing digits with :z flag parameter 1/19');
is(FatRat.new(1,20).precise(45, :z), '0.050000000000000000000000000000000000000000000', 'Testing digits with :z flag parameter 1/20');
is(FatRat.new(1,21).precise(45, :z), '0.047619047619047619047619047619047619047619048', 'Testing digits with :z flag parameter 1/21');
is(FatRat.new(1,22).precise(45, :z), '0.045454545454545454545454545454545454545454545', 'Testing digits with :z flag parameter 1/22');
is(FatRat.new(1,23).precise(45, :z), '0.043478260869565217391304347826086956521739130', 'Testing digits with :z flag parameter 1/23');
is(FatRat.new(1,24).precise(45, :z), '0.041666666666666666666666666666666666666666667', 'Testing digits with :z flag parameter 1/24');
is(FatRat.new(1,25).precise(45, :z), '0.040000000000000000000000000000000000000000000', 'Testing digits with :z flag parameter 1/25');


is(FatRat.new(1,7**35).precise,         '0.00000000000000000000000000000264', 'FatRat returns 32 places of precision by default');
is(FatRat.new(1,7**35).precise(50),     '0.00000000000000000000000000000263978525985381424962', 'digits parameter works');
is(FatRat.new(1,7**35).precise(54),     '0.00000000000000000000000000000263978525985381424961913', 'Non-significant zeros are trimmed');
is(FatRat.new(1,7**35).precise(54, :z), '0.000000000000000000000000000002639785259853814249619130', 'unless the :z parameter is set');
is(FatRat.new(1,7**35).precise(15),     '0', 'Degenerate non-significant zeros are trimmed');
is(FatRat.new(1,7**35).precise(15, :z), '0.000000000000000', 'unless the :z parameter is set');
is(FatRat.new(1,7**35).precise(0),      '0', 'Zero places returns integer portion only');

is(FatRat.new(9999999999999999999999999999999999999999999999999999999,10000000000000000000000000000000000000000000000000000000).precise,
             '0.9999999999999999999999999999999999999999999999999999999','No rounding when not appropriate');
is(FatRat.new(9999999999999999999999999999999999999999999999999999999,10000000000000000000000000000000000000000000000000000000).precise(15),
             '1', 'Rounds when appropriate');
is(FatRat.new(9999999999999999999999999999999999999999999999999999999,10000000000000000000000000000000000000000000000000000000).precise(15,:z),
             '1.000000000000000', 'Rounds but preserves zeros');

done-testing;


