摘要
闰年的判断是一个相对复杂的逻辑运算过程,逻辑运算中短路机制的运用可以提升判断的执行效率。本文通过对四种不同顺序组合的闰年和平年判断条件在一个判断周期内的判断次数进行了研究,发现了具有最高执行效率的逻辑表达式,提出了较为合理的判断程序代码。
The determination of leap years is a relatively complex logical operation process,and the use of short-circuit mechanisms in logical operations can improve the execution efficiency of judgment.This article studies the number of judgments in a judgment cycle for four different combinations of leap year and normal year judgment conditions,and discovers the logical expression with the highest execution efficiency.A more reasonable judgment program code is proposed.
作者
雒晓霞
LUO Xiao-xia(Kunshan Second Vocational School,Jiangsu Province,Kunshan 215300,China;Kunshan Open University,Kunshan 215300,China)
出处
《价值工程》
2024年第35期139-141,共3页
Value Engineering
关键词
逻辑运算
短路机制
闰年判断
logical operation
short-circuit mechanism
leap year judgment