কম্পিউটার টিউটোরিয়াল

C# Double.IsPositiveInfinity() মেথড

C#-এ Double.IsPositiveInfinity() মেথড একটি নির্দিষ্ট ডাবল মান পজিটিভ ইনফিনিটি (ধনাত্মক অসীম) কিনা তা যাচাই করে। এটি একটি বুলিয়ান মান ফেরত দেয়।

সিনট্যাক্স

public static bool IsPositiveInfinity (double val);

এখানে, val হলো একটি ডাবল-প্রিসিশন ফ্লোটিং-পয়েন্ট সংখ্যা।

উদাহরণ ১

using System;

public class Demo {
    public static void Main() {
        double d = 1.0 / 0.0;
        Console.WriteLine("Double Value = " + d);
        Console.WriteLine("HashCode of Double Value = " + d.GetHashCode());
        TypeCode type = d.GetTypeCode();
        Console.WriteLine("TypeCode of Double Value = " + type);
        Console.WriteLine("Positive Infinity? = " + Double.IsInfinity(d));
        Console.WriteLine("Check whether the specified value is NaN? = " + Double.IsNaN(d));
        Console.WriteLine("Does the value evaluate to negative infinity? = " + Double.IsNegativeInfinity(d));
        Console.WriteLine("Does the value evaluate to positive infinity? = " + Double.IsPositiveInfinity(d));
    }
}

আউটপুট

Double Value = ∞
HashCode of Double Value = 2146435072
TypeCode of Double Value = Double
Positive Infinity? = True
Check whether the specified value is NaN? = False
Does the value evaluate to negative infinity? = False
Does the value evaluate to positive infinity? = True

উদাহরণ ২

using System;

public class Demo {
    public static void Main() {
        double d = -50.0 / 0.0;
        Console.WriteLine("Double Value = " + d);
        Console.WriteLine("HashCode of Double Value = " + d.GetHashCode());
        TypeCode type = d.GetTypeCode();
        Console.WriteLine("TypeCode of Double Value = " + type);
        Console.WriteLine("Positive Infinity? = " + Double.IsInfinity(d));
        Console.WriteLine("Check whether the specified value is NaN? = " + Double.IsNaN(d));
        Console.WriteLine("Does the value evaluate to negative infinity? = " + Double.IsNegativeInfinity(d));
        Console.WriteLine("Does the value evaluate to positive infinity? = " + Double.IsPositiveInfinity(d));
    }
}

আউটপুট

Double Value = -∞
HashCode of Double Value = -1048576
TypeCode of Double Value = Double
Positive Infinity? = True
Check whether the specified value is NaN? = False
Does the value evaluate to negative infinity? = True
Does the value evaluate to positive infinity? = False
  1. C#-এ Math.Log10() মেথড

  2. C#-এ Math.Log() মেথড

  3. C#-এ Math.IEEERemainder() মেথড

  4. C#-এ Char.IsWhiteSpace() মেথড