从浮点数中提取10 进制科学计数法(Value = Mantissa × 10^Exponent,要求1 ≤ |Mantissa| < 10)的尾数(Mantissa)和指数(Exponent),解决小数值(如 1E-11)的精度异常问题。
利用对数运算 + 取整 + 幂运算实现:
指数:Exponent = floor(log₁₀(|Value|))(向下取整,避免精度误差);
尾数:Mantissa = Value / 10^Exponent(等价于Value × 10^(-Exponent))。
程序框图实现步骤(带函数位置)

步骤 1:输入与预处理
拖入双精度数值输入控件(命名:Input_Value);
(可选)添加绝对值函数(数值→比较→Absolute Value)处理负数,保证对数运算合法性。
步骤 2:计算对数
拖入Logarithm Base 10 函数(数值→初等函数→Logarithm→Log Base 10),输入Input_Value的绝对值,输出Log10_Value。
步骤 3:计算指数
拖入Round To -Infinity 函数(数值→转换→Round To -Infinity),输入Log10_Value,输出Exponent(向下取整,解决小数值精度问题)。
步骤 4:计算尾数
拖入Power Of 10 函数(数值→初等函数→Exponential→Power Of 10),输入-Exponent,输出10^(-Exponent);
拖入乘法函数,输入Input_Value和10^(-Exponent),输出Mantissa。
步骤 5:输出
拖入双精度数值显示控件,分别绑定Mantissa和Exponent。


客服
小程序
公众号