当前位置:网站首页>在代碼中使用度量單比特,從而生活更美好
在代碼中使用度量單比特,從而生活更美好
2022-07-04 04:49:00 【dotNET跨平臺】
在我們的應用軟件中,涉及到物理化學計算時,只有 Frink 、F#、Modelica 少數語言變量是自帶單比特的,大部分語言變量僅包含數值,單比特轉換需要在變量進行公式計算之前完成,計算後再把結果單比特轉換為輸出單比特,單比特轉換主要通過若幹常數實現。這帶來了兩個問題:
大量常數降低代碼可讀性和維護性;
計算精度難以保障。
UnitsNet 用具有單比特的變量替代double,支持單比特的自動轉換,並(部分)支持不同單比特的乘除計算。使用UnitsNet 寫公式計算代碼,可以避免直接的單比特轉換,使程序的調用者可以使用任意單比特作為輸入。在.NET IoT 將 UnitsNet 用於任何傳感器在綁定中公開的任何單元。在文檔裏有明確的設備 API 的約定:https://github.com/dotnet/iot/blob/main/Documentation/Devices-conventions.md
相關參考文章:
理化計算程序必備:CoolProp+UnitsNet:https://blog.csdn.net/xhydongda/article/details/120663619
深入研究 .NET NANOFRAMEWORK 的一年:https://www.nanoframework.net/laurent-ellerbach-a-year-deeply-in-net-nanoframework/
边栏推荐
- Operate the server remotely more gracefully: the practice of paramiko Library
- LeetCode136+128+152+148
- Can closed data be deleted by DBCA? can
- Annex V: briefing on the attack process docx
- I.MX6U-ALPHA开发板(C语言版本LED驱动实验)
- Create ASM disk through DD
- How do good test / development programmers practice? Where to go
- Touch your hand and bring you a commonjs specification
- 【安全攻防】序列化与反序列,你了解多少?
- EventBridge 在 SaaS 企业集成领域的探索与实践
猜你喜欢
Exploration and practice of eventbridge in the field of SaaS enterprise integration
6-4 vulnerability exploitation SSH banner information acquisition
RPC Technology
20000 words will take you to master multithreading
What is context?
牛客小白月赛49
Talking about JVM
FT2000+下LPC中断绑核使用说明
分布式CAP理论
[security attack and Defense] how much do you know about serialization and deserialization?
随机推荐
附件一:202x年xxx攻防演习授权委托书
十字路口通行优先权,十字路口通行规则图解
网络设备应急响应指南
Solve the problem of failed to load property source from location 'classpathapplication YML 'problem
How to view installed r packages in R language
6-5漏洞利用-SSH弱口令破解利用
软件设计文档示例模板 - 学习/实践
【云原生】那些看起来很牛X,原理却很简单的一行代码
[go] database framework Gorm
附件五:攻击过程简报.docx
红队视角下的防御体系突破之第一篇介绍、阶段、方法
Deep parsing structured exception handling (SEH) - by Matt Pietrek
旭化成首次参展第五届中国国际进口博览会(5th CIIE)
y55.第三章 Kubernetes从入门到精通 -- HPA控制器及metrics-server(二八)
Rhcsa 06 - suid, sgid, sticky bit (to be added)
MIN_RTO 对话
[cloud native] those lines of code that look awesome but have a very simple principle
Distributed cap theory
沃博联结束战略评估,决定保留表现优异的博姿业务
What is context?