ভূমিকা
NumPy-এর numpy.finfo() মেথড ফ্লোটিং পয়েন্ট ডেটা টাইপের মেশিন লিমিট (ন্যূনতম ও সর্বোচ্চ মান) সম্পর্কে তথ্য প্রদান করে। ইন্সট্যান্স পাস করলে সেই টাইপের লিমিটগুলো দেখা যায়।
ধাপসমূহ
- লাইব্রেরি আমদানি:
import numpy as np - বিভিন্ন ফ্লোট টাইপের জন্য লিমিট চেক:
# float16 a = np.finfo(np.float16(12.5)) print("Minimum of float16 type...\n", a.min) print("Maximum of float16 type...\n", a.max) # float32 b = np.finfo(np.float32(30.5)) print("\nMinimum of float32 type...\n", b.min) print("Maximum of float32 type...\n", b.max) # float64 (ডিফল্ট float) c = np.finfo(np.float64(55.9)) print("\nMinimum of float64 type...\n", c.min) print("Maximum of float64 type...\n", c.max)
সম্পূর্ণ উদাহরণ
import numpy as np
a = np.finfo(np.float16(12.5))
print("Minimum of float16 type...\n", a.min)
print("Maximum of float16 type...\n", a.max)
b = np.finfo(np.float32(30.5))
print("\nMinimum of float32 type...\n", b.min)
print("Maximum of float32 type...\n", b.max)
c = np.finfo(np.float64(55.9))
print("\nMinimum of float64 type...\n", c.min)
print("Maximum of float64 type...\n", c.max)
আউটপুট
Minimum of float16 type...
-65500.0
Maximum of float16 type...
65500.0
Minimum of float32 type...
-3.4028235e+38
Maximum of float32 type...
3.4028235e+38
Minimum of float64 type...
-1.7976931348623157e+308
Maximum of float64 type...
1.7976931348623157e+308