当前位置:网站首页>在代码中使用度量单位,从而生活更美好
在代码中使用度量单位,从而生活更美好
2022-07-04 03:55: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/
边栏推荐
猜你喜欢

NFT new opportunity, multimedia NFT aggregation platform okaleido will be launched soon

Rhcsa 04 - process management

Many founders of technology companies provided enterpriser first with a round C financing of up to US $158million to help it invest in the next generation of global innovators

Architecture practice camp - graduation project of module 9 of phase 6

Formatted text of Kivy tutorial (tutorial includes source code)

附件六:防守工作简报.docx

Beipiao programmer, 20K monthly salary, 15W a year, normal?

Redis: order collection Zset type data operation command

Imitation of "game bird" source code, mobile game issue evaluation, open service, open test collection, game download website template

FT2000+下LPC中断绑核使用说明
随机推荐
关闭的数据能用dbca删除吗? 能
Apple CMS imitation watermelon video atmospheric response video template source code
Niuke Xiaobai monthly race 49
Many founders of technology companies provided enterpriser first with a round C financing of up to US $158million to help it invest in the next generation of global innovators
Experience sharing of epidemic telecommuting | community essay solicitation
MIN_ RTO dialog
Redis: operation command for collecting set type data
附件一:202x年xxx攻防演习授权委托书
Pytest basic self-study series (I)
UnicodeDecodeError: ‘gbk‘ codec can‘t decode byte 0x98 in position 1093: illegal multibyte sequence
Can closed data be deleted by DBCA? can
Emlog user registration plug-in is worth 80 yuan
MySQL indexes and transactions
郑州正清园文化传播有限公司:针对小企业的7种营销技巧
RAC delete damaged disk group
最长递增子序列问题(你真的会了吗)
Precautions for accompanying driving these 23 points should be paid attention to!
十字路口通行优先权,十字路口通行规则图解
Architecture training graduation design + summary
[Yugong series] go teaching course 001 in July 2022 - Introduction to go language premise