gpt4 book ai didi

elixir - 如何获取e剂中每种类型的最小值和最大值

转载 作者:行者123 更新时间:2023-12-04 03:07:15 25 4
gpt4 key购买 nike

如何获取e剂中每种类型的最小值和最大值?例如整数,浮点数和字符串的最大可能长度。

我知道在C语言中,它在limits.h中定义为INT_MININT_MAX等。关于 Elixir 中这些类型的限制的文档在哪里?

最佳答案

Elixir(实际上是Erlang)使用bignum arithmetic,这是计算机科学中使用的一种算术软件,其中(引用Wikipedia)

calculations are performed on numbers whose digits of precision are limited only by the available memory of the host system



Erlang文档中有 a page,它讨论了Erlang VM的限制(例如,原子最多可以包含255个字符);正如您所看到的,如果您看一下该页面,甚至没有提到整数限制。

Erlang/Elixir中的整数仅受系统上可用内存的限制,因此实际上 没有限制,其大小可以限制为

对于二进制文件(字符串),我只引用上面链接的页面所说的内容:

In the 32-bit implementation of Erlang, 536870911 bytes is the largest binary that can be constructed or matched using the bit syntax. (In the 64-bit implementation, the maximum size is 2305843009213693951 bytes.) If the limit is exceeded, bit syntax construction will fail with a system_limit exception, while any attempt to match a binary that is too large will fail. This limit is enforced starting with the R11B-4 release; in earlier releases, operations on too large binaries would in general either fail or give incorrect results. In future releases of Erlang/OTP, other operations that create binaries (such as list_to_binary/1) will probably also enforce the same limit.

关于elixir - 如何获取e剂中每种类型的最小值和最大值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28093580/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com