Skip to content

Commit b6ffc36

Browse files
committed
CLJCLR-173: Fix (rationalize 1) (Typo in clojure.lang.Number.rationalize.)
1 parent 192a8a7 commit b6ffc36

File tree

1 file changed

+51
-51
lines changed

1 file changed

+51
-51
lines changed

Clojure/Clojure/Lib/Numbers.cs

Lines changed: 51 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,10 @@ interface Ops
162162
{
163163
Ops combine(Ops y);
164164
Ops opsWith(LongOps x);
165-
Ops opsWith(ULongOps x);
165+
Ops opsWith(ULongOps x);
166166
Ops opsWith(DoubleOps x);
167167
Ops opsWith(RatioOps x);
168-
Ops opsWith(ClrDecimalOps x);
168+
Ops opsWith(ClrDecimalOps x);
169169
Ops opsWith(BigIntOps x);
170170
Ops opsWith(BigDecimalOps x);
171171

@@ -238,7 +238,7 @@ public object incP(object x)
238238
{
239239
return inc(x);
240240
}
241-
241+
242242
public object unchecked_inc(object x)
243243
{
244244
return inc(x);
@@ -274,7 +274,7 @@ public object unchecked_dec(object x)
274274
public abstract bool equiv(object x, object y);
275275
public abstract bool lt(object x, object y);
276276
public abstract bool lte(object x, object y);
277-
public abstract bool gte(object x, object y);
277+
public abstract bool gte(object x, object y);
278278
public abstract object negate(object x);
279279
public abstract object inc(object x);
280280
public abstract object dec(object x);
@@ -302,7 +302,7 @@ public object unchecked_dec(object x)
302302
public static bool isZero(ulong x) { return x == 0; }
303303

304304

305-
public static bool isZero(decimal x) { return x == 0m; }
305+
public static bool isZero(decimal x) { return x == 0m; }
306306

307307

308308

@@ -584,7 +584,7 @@ public static ulong minus(ulong x)
584584

585585

586586
public static double minusP(double x) { return -x; }
587-
587+
588588

589589
public static object minusP(long x)
590590
{
@@ -680,7 +680,7 @@ public static ulong minus(ulong x, ulong y)
680680

681681
public static object minus(ulong x, long y) { return minus((Object)x, (Object)y); }
682682

683-
683+
684684

685685
public static object minusP(object x, object y)
686686
{
@@ -1179,7 +1179,7 @@ public static double quotient(double n, double d)
11791179

11801180

11811181
public static double quotient(long x, double y) { return quotient((double)x, y); }
1182-
1182+
11831183

11841184
public static object quotient(long x, Object y) { return quotient((Object)x, y); }
11851185

@@ -1227,7 +1227,7 @@ public static double remainder(double n, double d)
12271227

12281228

12291229
public static object remainder(Object x, double y) { return remainder(x, (Object)y); }
1230-
1230+
12311231

12321232
public static double remainder(double x, long y) { return remainder(x, (double)y); }
12331233

@@ -1359,8 +1359,8 @@ public static object decP(decimal x)
13591359

13601360

13611361

1362-
public static double unchecked_inc(double x) { return inc(x); }
1363-
1362+
public static double unchecked_inc(double x) { return inc(x); }
1363+
13641364

13651365

13661366
public static long unchecked_inc(long x) { return x + 1; }
@@ -1371,8 +1371,8 @@ public static object decP(decimal x)
13711371

13721372

13731373

1374-
public static decimal unchecked_inc(decimal x) { return inc(x); }
1375-
1374+
public static decimal unchecked_inc(decimal x) { return inc(x); }
1375+
13761376

13771377

13781378
public static object unchecked_dec(object x) { return ops(x).unchecked_dec(x); }
@@ -1388,10 +1388,10 @@ public static object decP(decimal x)
13881388

13891389

13901390
public static ulong unchecked_dec(ulong x) { return x - 1; }
1391-
13921391

13931392

1394-
public static decimal unchecked_dec(decimal x) { return dec(x); }
1393+
1394+
public static decimal unchecked_dec(decimal x) { return dec(x); }
13951395

13961396
#endregion
13971397

@@ -1415,7 +1415,7 @@ public static int compare(object x, object y)
14151415
else
14161416
return 0;
14171417
}
1418-
1418+
14191419
#endregion
14201420

14211421
#region equiv, lt, lte, gt, gte
@@ -1478,7 +1478,7 @@ public static int compare(object x, object y)
14781478

14791479

14801480
public static bool lt(double x, double y) { return x < y; }
1481-
1481+
14821482

14831483
public static bool lt(long x, long y) { return x < y; }
14841484

@@ -1629,7 +1629,7 @@ public static int compare(object x, object y)
16291629

16301630

16311631
public static bool gt(ulong x, long y) { return gt((Object)x, (Object)y); }
1632-
1632+
16331633

16341634

16351635
public static bool gte(object x, object y) { return ops(x).combine(ops(y)).gte(x, y); }
@@ -1897,7 +1897,7 @@ public static long min(long x, long y)
18971897

18981898
public static ulong min(ulong x, ulong y)
18991899
{
1900-
return Math.Min(x, y);
1900+
return Math.Min(x, y);
19011901
}
19021902

19031903

@@ -2217,7 +2217,7 @@ public static Ratio ToRatio(object x)
22172217
return r;
22182218

22192219
BigDecimal bx = x as BigDecimal;
2220-
if ( bx != null )
2220+
if (bx != null)
22212221
{
22222222
int exp = bx.Exponent;
22232223
if (exp >= 0)
@@ -2233,13 +2233,13 @@ public static Ratio ToRatio(object x)
22332233
[WarnBoxedMath(false)]
22342234
public static object rationalize(object x)
22352235
{
2236-
if (x is float f)
2236+
if (x is float f)
22372237
return rationalize(BigDecimal.Create(f));
22382238

2239-
if (x is double d)
2239+
if (x is double d)
22402240
return rationalize(BigDecimal.Create(d));
22412241

2242-
BigDecimal bx = (BigDecimal)x;
2242+
BigDecimal bx = x as BigDecimal;
22432243
if (bx != null)
22442244
{
22452245
int exp = bx.Exponent;
@@ -2296,7 +2296,7 @@ public static int shiftLeftInt(int x, int n)
22962296

22972297
public static object shiftLeft(object x, object n)
22982298
{
2299-
return shiftLeft(bitOpsCast(x),bitOpsCast(n));
2299+
return shiftLeft(bitOpsCast(x), bitOpsCast(n));
23002300
}
23012301

23022302

@@ -2458,7 +2458,7 @@ public bool isNeg(object x)
24582458

24592459
public object add(object x, object y)
24602460
{
2461-
return num(Numbers.add( Util.ConvertToLong(x), Util.ConvertToLong(y)));
2461+
return num(Numbers.add(Util.ConvertToLong(x), Util.ConvertToLong(y)));
24622462
}
24632463

24642464
public object addP(object x, object y)
@@ -2517,7 +2517,7 @@ public object divide(object x, object y)
25172517
long n = Util.ConvertToLong(x);
25182518
long val = Util.ConvertToLong(y);
25192519

2520-
if ( n == long.MinValue || val == long.MinValue )
2520+
if (n == long.MinValue || val == long.MinValue)
25212521
return BIGINT_OPS.divide(x, y);
25222522

25232523
long gcd1 = gcd(n, val);
@@ -2565,7 +2565,7 @@ public bool gte(object x, object y)
25652565
{
25662566
return Util.ConvertToLong(x) >= Util.ConvertToLong(y);
25672567
}
2568-
2568+
25692569
public object negate(object x)
25702570
{
25712571
long val = Util.ConvertToLong(x);
@@ -2710,9 +2710,9 @@ public object addP(object x, object y)
27102710
{
27112711
ulong ulx = Util.ConvertToULong(x);
27122712
ulong uly = Util.ConvertToULong(y);
2713-
if ( ulx > ulong.MaxValue - uly )
2713+
if (ulx > ulong.MaxValue - uly)
27142714
return BIGINT_OPS.add(x, y);
2715-
return num(ulx+uly);
2715+
return num(ulx + uly);
27162716
}
27172717

27182718
public object unchecked_add(object x, object y)
@@ -2765,7 +2765,7 @@ public object divide(object x, object y)
27652765
ulong d = val / gcd1;
27662766
if (d == 1)
27672767
return num(n);
2768-
2768+
27692769
return new Ratio(BigInteger.Create(n), BigInteger.Create(d));
27702770
}
27712771

@@ -3135,7 +3135,7 @@ public override bool equiv(object x, object y)
31353135
{
31363136
Ratio rx = ToRatio(x);
31373137
Ratio ry = ToRatio(y);
3138-
3138+
31393139
return rx.numerator.Equals(ry.numerator)
31403140
&& rx.denominator.Equals(ry.denominator);
31413141
}
@@ -3166,7 +3166,7 @@ public override bool gte(object x, object y)
31663166

31673167
public override object negate(object x)
31683168
{
3169-
Ratio rx = (Ratio)x;
3169+
Ratio rx = (Ratio)x;
31703170
return new Ratio(-rx.numerator, rx.denominator);
31713171
}
31723172

@@ -3338,7 +3338,7 @@ public object divide(object x, object y)
33383338
{
33393339
return BigDecimal.Create(dx).Divide(BigDecimal.Create(dy));
33403340
}
3341-
3341+
33423342
}
33433343

33443344
public object quotient(object x, object y)
@@ -3384,20 +3384,20 @@ public object negate(object x)
33843384
public object negateP(object x)
33853385
{
33863386
decimal val = Util.ConvertToDecimal(x);
3387-
return -val;
3387+
return -val;
33883388
}
33893389

33903390
public object unchecked_negate(object x)
33913391
{
33923392
decimal val = Util.ConvertToDecimal(x);
3393-
return -val;
3393+
return -val;
33943394
}
33953395

33963396

33973397
public object inc(object x)
33983398
{
33993399
decimal val = Util.ConvertToDecimal(x);
3400-
return val + 1;
3400+
return val + 1;
34013401
}
34023402

34033403
public object incP(object x)
@@ -3421,7 +3421,7 @@ public object unchecked_inc(object x)
34213421
public object dec(object x)
34223422
{
34233423
decimal val = Util.ConvertToDecimal(x);
3424-
return val - 1;
3424+
return val - 1;
34253425
}
34263426

34273427
public object decP(object x)
@@ -3536,7 +3536,7 @@ public override object multiply(object x, object y)
35363536

35373537
public override object divide(object x, object y)
35383538
{
3539-
return BIDivide(ToBigInteger(x),ToBigInteger(y));
3539+
return BIDivide(ToBigInteger(x), ToBigInteger(y));
35403540
}
35413541

35423542
public override object quotient(object x, object y)
@@ -3759,13 +3759,13 @@ public override object abs(object x)
37593759

37603760
#region Ops/BitOps dispatching
37613761

3762-
static readonly LongOps LONG_OPS = new LongOps();
3763-
static readonly ULongOps ULONG_OPS = new ULongOps();
3764-
static readonly DoubleOps DOUBLE_OPS = new DoubleOps();
3765-
static readonly RatioOps RATIO_OPS = new RatioOps();
3766-
static readonly ClrDecimalOps CLRDECIMAL_OPS = new ClrDecimalOps();
3767-
static readonly BigIntOps BIGINT_OPS = new BigIntOps();
3768-
static readonly BigDecimalOps BIGDECIMAL_OPS = new BigDecimalOps();
3762+
static readonly LongOps LONG_OPS = new();
3763+
static readonly ULongOps ULONG_OPS = new();
3764+
static readonly DoubleOps DOUBLE_OPS = new();
3765+
static readonly RatioOps RATIO_OPS = new();
3766+
static readonly ClrDecimalOps CLRDECIMAL_OPS = new();
3767+
static readonly BigIntOps BIGINT_OPS = new();
3768+
static readonly BigDecimalOps BIGDECIMAL_OPS = new();
37693769

37703770
public enum Category { Integer, Floating, Decimal, Ratio } // TODO
37713771

@@ -3812,14 +3812,14 @@ static Ops ops(Object x)
38123812
[WarnBoxedMath(false)]
38133813
public static int hasheqFrom(object x, Type xc)
38143814
{
3815-
if ( xc == typeof(int)
3815+
if (xc == typeof(int)
38163816
|| xc == typeof(short)
38173817
|| xc == typeof(byte)
38183818
|| xc == typeof(ulong)
38193819
|| xc == typeof(uint)
38203820
|| xc == typeof(ushort)
38213821
|| xc == typeof(sbyte)
3822-
|| (xc == typeof(BigInteger) && lte(x,Int64.MaxValue) && gte(x,Int64.MinValue)))
3822+
|| (xc == typeof(BigInteger) && lte(x, Int64.MaxValue) && gte(x, Int64.MinValue)))
38233823
{
38243824
long lpart = Util.ConvertToLong(x);
38253825
return Murmur3.HashLong(lpart);
@@ -3850,7 +3850,7 @@ public static int hasheqFrom(object x, Type xc)
38503850
}
38513851
}
38523852

3853-
if ( xc == typeof(float) && x.Equals(-0.0f))
3853+
if (xc == typeof(float) && x.Equals(-0.0f))
38543854
{
38553855
return 0; // match 0.0f
38563856
}
@@ -3867,7 +3867,7 @@ public static int hasheq(object x)
38673867
if (xc == typeof(long))
38683868
{
38693869
//return (int)(lpart ^ (lpart >> 32));
3870-
return Murmur3.HashLong((long) x);
3870+
return Murmur3.HashLong((long)x);
38713871
}
38723872
if (xc == typeof(double))
38733873
{
@@ -3908,7 +3908,7 @@ static long bitOpsCast(object x)
39083908
}
39093909

39103910
#endregion
3911-
3911+
39123912
#region Array c-tors
39133913

39143914

@@ -4522,7 +4522,7 @@ public static long and(long x, long y)
45224522

45234523
public static long or(object x, object y)
45244524
{
4525-
return or(bitOpsCast(x),bitOpsCast(y));
4525+
return or(bitOpsCast(x), bitOpsCast(y));
45264526
}
45274527

45284528

0 commit comments

Comments
 (0)