2

我正在尝试将一个大浮点数“推”入一个元组。但得到以下错误:

# where test() is a function with big floats as values

store = Tuple{Any, Any}][]
for i in 1:10
    push!(store, test(i))
end
store

在此处输入图像描述

错误消息提到convert()作为解决方案,但我不知道如何转换test().

4

1 回答 1

2

你不能推BigFloat入一个只接受的容器Tuples。你的容器必须接受BigFloats ,所以初始化它:

store = BigFloat[]

另请注意,您可能刚刚写过:

store = test.(1:10)
于 2021-07-30T11:11:32.570 回答