如何在float类型中编写一个数字?

发布于 2025-02-05 14:53:58 字数 97 浏览 0 评论 0原文

我有以下问题要解决的问题: 在类型float中写下诸如1066018.050之类的数字, 结果应采用二进制或十六进制格式。 我的问题是,为了解决这个问题,我需要遵循什么正确的步骤?

I have the following problem to solve in C#:
Write a number such as 1066018.050 in type float,
the result should be in binary or hexadecimal format.
My question is what are the correct steps I need to follow in order to solve this problem?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

榆西 2025-02-12 14:53:59

您可以使用bitConverter.getBytes(float)

float a = (1066018.050F);
var b = BitConverter.GetBytes(a);

You can use BitConverter.GetBytes(float).

float a = (1066018.050F);
var b = BitConverter.GetBytes(a);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文