excel - VBA抛出错误中的简单浮点运算
问题描述
我在 Excel VBA 模块中有以下代码:
Function f(a, b, c, d)
f = 1.95 * a * (b / c) ^ 0.06 * (d / c) ^ 0.06
End Function
Sub callf()
Debug.Print (f(-7, 10, 3.5, -6))
End Sub
当我运行 sub 时callf
出现错误:
运行时错误“5”:无效的过程调用或参数
我不知道为什么会发生这种情况。我不是在这里做简单的浮点运算吗?有任何想法吗?
解决方案
因为你正在提升-1.7
权力0.06
。结果是一个复数。
推荐阅读
- python - 将文件上传到谷歌翻译器进行翻译
- javascript - Icecast 用户认证和网络音频 API
- json - 从 Python 中的列表创建 JSON
- spring - 这段代码在 Spring Boot 自定义类型级别注解中做了什么?
- reactjs - 为什么我的 Redux Store 中创建了多个嵌套状态
- python - Python3 Windows 10 中的 Pip 安装索引器错误
- java - 如何使用@JsonTypeInfo、@JsonSubType 根据兄弟字段的值确定字段类型?
- database - 如何以无损方式将 sqlite 数据库作为明文存储在 git 中?
- python - 我怎样才能在一个嵌入中获得所有内容?
- python - 如何从列表中创建多个键,每个键都分配给一个唯一的数组?