切记:
float test;
进行除法运算的时候要注意:
test = 8 / 10;
Debug.log(" test is ---> "+ test); =====> test is 0;
改:
test = 8 .0f / 10.0f;
Debug.log(" test is ---> "+ test); =====> test is 0.8;
本文揭示了在使用整数进行除法运算时,如果不转换为浮点数会导致结果被截断为0的问题。通过具体示例展示了如何正确地进行浮点数除法运算,避免结果失真。
切记:
float test;
进行除法运算的时候要注意:
test = 8 / 10;
Debug.log(" test is ---> "+ test); =====> test is 0;
改:
test = 8 .0f / 10.0f;
Debug.log(" test is ---> "+ test); =====> test is 0.8;
您可能感兴趣的与本文相关的镜像
Langchain-Chatchat
Langchain-Chatchat 是一个基于 ChatGLM 等大语言模型和 Langchain 应用框架实现的开源项目,旨在构建一个可以离线部署的本地知识库问答系统。它通过检索增强生成 (RAG) 的方法,让用户能够以自然语言与本地文件、数据库或搜索引擎进行交互,并支持多种大模型和向量数据库的集成,以及提供 WebUI 和 API 服务
2216

被折叠的 条评论
为什么被折叠?