@@ -70,7 +70,7 @@ public Rational(double value)
7070 /// <param name="bestPrecision">Whether to use the best possible precision when parsing the value.</param>
7171 public Rational ( double value , bool bestPrecision )
7272 {
73- var rational = LongRational . FromDouble ( Math . Abs ( value ) , bestPrecision ) ;
73+ LongRational rational = LongRational . FromDouble ( Math . Abs ( value ) , bestPrecision ) ;
7474
7575 this . Numerator = ( uint ) rational . Numerator ;
7676 this . Denominator = ( uint ) rational . Denominator ;
@@ -109,7 +109,7 @@ public Rational(double value, bool bestPrecision)
109109 /// <returns>
110110 /// The <see cref="Rational"/>.
111111 /// </returns>
112- public static Rational FromDouble ( double value ) => new Rational ( value , false ) ;
112+ public static Rational FromDouble ( double value ) => new ( value , false ) ;
113113
114114 /// <summary>
115115 /// Converts the specified <see cref="double"/> to an instance of this type.
@@ -119,24 +119,19 @@ public Rational(double value, bool bestPrecision)
119119 /// <returns>
120120 /// The <see cref="Rational"/>.
121121 /// </returns>
122- public static Rational FromDouble ( double value , bool bestPrecision ) => new Rational ( value , bestPrecision ) ;
122+ public static Rational FromDouble ( double value , bool bestPrecision ) => new ( value , bestPrecision ) ;
123123
124124 /// <inheritdoc/>
125125 public override bool Equals ( object ? obj ) => obj is Rational other && this . Equals ( other ) ;
126126
127127 /// <inheritdoc/>
128128 public bool Equals ( Rational other )
129- {
130- var left = new LongRational ( this . Numerator , this . Denominator ) ;
131- var right = new LongRational ( other . Numerator , other . Denominator ) ;
132-
133- return left . Equals ( right ) ;
134- }
129+ => this . Numerator == other . Numerator && this . Denominator == other . Denominator ;
135130
136131 /// <inheritdoc/>
137132 public override int GetHashCode ( )
138133 {
139- var self = new LongRational ( this . Numerator , this . Denominator ) ;
134+ LongRational self = new ( this . Numerator , this . Denominator ) ;
140135 return self . GetHashCode ( ) ;
141136 }
142137
@@ -169,7 +164,7 @@ public override int GetHashCode()
169164 /// <returns>The <see cref="string"/></returns>
170165 public string ToString ( IFormatProvider provider )
171166 {
172- var rational = new LongRational ( this . Numerator , this . Denominator ) ;
167+ LongRational rational = new ( this . Numerator , this . Denominator ) ;
173168 return rational . ToString ( provider ) ;
174169 }
175170}
0 commit comments