博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
IDL divide by zero
阅读量:2444 次
发布时间:2019-05-10

本文共 771 字,大约阅读时间需要 2 分钟。

Here is the solution for integers (represented as floating arrays, if you want to do floating point arithmetic, of course). The variable replacement_value represents whatever value you think is appropriate in the circumstances. Something like 1e-6 often works fine.

IDL> c = a / (b + replacement_value * (b EQ 0))

For floating point values, where the number zero cannot be assumed to be exactly zero, Jean Hasban suggests this variation,

IDL> c = a / (b + replacement_value * (ABS(b) LT epsilon))

where epsilon is usually taken to be something like the smallest number that can be represented on your computer, or:

IDL> epsilon = (Machar()).eps   IDL> Print, epsilon        1.19209e-007

Other users just prefer to get the error. Then, at least they know what is going on.

转载地址:http://yviqb.baihongyu.com/

你可能感兴趣的文章
推荐一款 Linux 上比较漂亮的字体(转)
查看>>
在Linux中添加新的系统调用(转)
查看>>
Fedora Core 5.0 安装教程{下载}(转)
查看>>
把ACCESS的数据导入到Mysql中(转)
查看>>
shell里边子函数与主函数的实例(转)
查看>>
Linux中MAXIMA符号运算软件的简介(转)
查看>>
银行选择Linux 则无法回避高成本(转)
查看>>
上网聊天需要防范的几大威胁(转)
查看>>
[分享]后门清除完全篇(转)
查看>>
用php在linux下连接mssql2000(转)
查看>>
让你的Linux支持WEB修改密码(转)
查看>>
MYSQL的master/slave数据同步配置(转)
查看>>
一个完整的ftp远程批量shell(转)
查看>>
Vsftpd匿名无法上传,配置如下,帮忙找下原因,谢谢~!(转)
查看>>
crontab命令简介(转)
查看>>
C++中的静态联编和动态联编介绍(转)
查看>>
带有农历的日历(QT版本1752-2100)(转)
查看>>
LINUX的系统内核空间的保护(转)
查看>>
在Visual C++中利用UDL文件建ADO连接(转)
查看>>
C++编程批评系列 继承的本质(转)
查看>>