Scala 中的无符号整数 [英] Unsigned integer in scala

查看:116
本文介绍了Scala 中的无符号整数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要求只存储正值.据我了解,signed 可以存储正值和负值.Scala 中是否有任何无符号整数、双精度数据类型?

I have a requirement to store only positive values. As I understand, signed can store both positive and negative values. Are there any unsigned integer, double data types in Scala?

问候

推荐答案

有人提议在 Scala 中包含新的 unsigned Int 数据类型,但这会对性能产生影响.因此,维护 scala 的人决定不继续在 scala 中使用未签名的 Int 的提议.

There was a proposal to include new data types for unsigned Int in scala, but it was going to have a performance impact. Hence the people who maintain scala decided not to go ahead with the proposal of an unsigned Int in scala.

请参考以下https://docs.scala-lang.org/sips/unsigned-integers.html

您还可以参考 Scala 中的无符号变量.

这篇关于Scala 中的无符号整数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆