Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use np.finfo in numpy

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article shows you how to use np.finfo in numpy. The content is concise and easy to understand. It will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.

Example: "" the np.finfo method eps is a small non-negative division whose denominator cannot be 0, or it will directly pop up to display an error. Use eps to replace the possible petty eps so that no error will be reported. "" Import numpy as npx = np.array ([1,2,3], dtype=float) eps = np.finfo (x.dtype). Eps # eps = 2.220446049250313e-16 type= print (eps, type (eps)) height = np.array ([0,2,3], dtype=float) height = np.maximum (height, eps) # once 0 appears in height Replace print (height) # [2.22044605e-16 2.00000000e+00 3.00000000e+00] dy = x / heightprint (dy) # [4.50359963e+15 1.00000000e+00 1.00000000e+00] with eps

The above is how to use np.finfo in numpy. Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report