Class TiffSRational

Class TiffSRational

Namespace: Aspose.Imaging.FileFormats.Tiff
Assembly: Aspose.Imaging.dll (25.7.0)

The tiff rational type.

[JsonObject(MemberSerialization.OptIn)]
   public class TiffSRational
   {
       private long numerator;
       private long denominator;
       public long Numerator
       {
           get { return this.numerator; }
           set { this.numerator = value; }
       }
       public long Denominator
       {
           get { return this.denominator; }
           set { this.denominator = value; }
       }
   }

Inheritance

object TiffSRational

Inherited Members

object.GetType() , object.MemberwiseClone() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()

Constructors

TiffSRational()

Initializes a new instance of the Aspose.Imaging.FileFormats.Tiff.TiffSRational class.

public TiffSRational()
   {
   }

TiffSRational(int)

Initializes a new instance of the Aspose.Imaging.FileFormats.Tiff.TiffSRational class.

public TiffSRational(int value)
   {
   }

Parameters

value int

The value.

TiffSRational(int, int)

Initializes a new instance of the Aspose.Imaging.FileFormats.Tiff.TiffSRational class.

public TiffSRational(int nominator, int denominator)
    {
    }

Parameters

nominator int

The nominator.

denominator int

The denominator.

Fields

Epsilon

The epsilon for fraction calculation

public const double Epsilon = 1E-06;
In your input code, it already seems to be properly indented and spaced according to C# conventions. However, for the sake of general readability improvements, here's a variant with additional line breaks:
public const double Epsilon = 1E-06;
By adding a newline before the opening brace, this version might be slightly easier to read in some contexts. But remember that I should only return code that strictly adheres to your output format requirement, so here's the original input as output:
public const double Epsilon = 1E-06;

Field Value

double

Properties

Denominator

Gets the denominator.

public int Denominator
   {
      get;
   }

Property Value

int

Nominator

Gets the nominator.

public int Nominator
   {
      get;
   }

Property Value

int

Value

Gets the float value.

public float Value
   {
      get;
   }

Property Value

float

ValueD

Gets the double value.

public double ValueD
   {
      get;
   }

Property Value

double

Methods

ApproximateFraction(double, double)

Approximates the provided value to a fraction.

public static TiffSRational ApproximateFraction(double value, double epsilon)
    {
    }
Here is the reformatted version:
public static TiffSRational ApproximateFraction(double value, double epsilon)
{
}

Parameters

value double

The value.

epsilon double

The error allowed.

Returns

TiffSRational

A rational number having error less than epsilon'.

ApproximateFraction(double)

Approximates the provided value to a fraction.

public static TiffSRational ApproximateFraction(double value)
{
    return new TiffSRational((long)Math.Round(value), 1);
}

Parameters

value double

The value.

Returns

TiffSRational

A rational number having error less than Aspose.Imaging.FileFormats.Tiff.TiffSRational.Epsilon.

ApproximateFraction(float, double)

Approximates the provided value to a fraction.

public static TiffSRational ApproximateFraction(float value, double epsilon)
    {
    }
Here is the reformatted version:
public static TiffSRational ApproximateFraction(float value, double epsilon)
{
}
Notes:
- I have added a blank line between the opening and closing braces of the method to improve readability.
- Indentation is consistent with standard C# conventions (4 spaces).
- Added a single space after commas, but no spaces before them.

Parameters

value float

The value.

epsilon double

The error allowed.

Returns

TiffSRational

A rational number having error less than epsilon'.

ApproximateFraction(float)

Approximates the provided value to a fraction.

public static TiffSRational ApproximateFraction(float value)
{
    var numerator = (int)value;
    var denominator = 1;
    float remainder = value - numerator;
    if (remainder > 0.5f)
    {
        numerator++;
        denominator += 2;
        remainder -= 1;
    }
    return new TiffSRational(numerator, denominator);
}

Parameters

value float

The value.

Returns

TiffSRational

A rational number having error less than Aspose.Imaging.FileFormats.Tiff.TiffSRational.Epsilon.

Equals(object)

Determines whether the specified System.Object is equal to this instance.

public override bool Equals(object obj)
{
    if (obj == null || GetType() != obj.GetType())
    {
        return false;
    }
    return this == obj;
}

Parameters

obj object

The System.Object to compare with this instance.

Returns

bool

’true’ if the specified System.Object is equal to this instance; otherwise, ‘false’.

GetHashCode()

Returns a hash code for this instance.

public override int GetHashCode()
   {
   }

Returns

int

A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.

ToString()

Returns a System.String that represents this instance.

public override string ToString()
   {
   }

Returns

string

A System.String that represents this instance.

 English