问题描述
我有一个函数(我们称之为 test(M) ),它只“吐出”BigFloats,如下所示。
test(100)
22.48487818538224586950434052086250350042005040604872584710165219826379165499864
我想绘制这个函数。但是,这似乎不适用于大型 Floats。
我什至尝试使用 round(Int8,test(x))
来缩小结果,但仍然无效。
using Plots
M = 1:10
plot(test.(M),xaxis=:log)
解决方法
它适用于我编写的随机函数,如下所示:
using Plots
test(x) = BigFloat(rand()) * 100 + x * rand()
M = 1:10
plot(test.(M),xaxis=:log)
那么,也许您的 test() 函数没有返回正确的 BigFloats 向量,即具有 Inf
之类的?