我有这个JavaScript函数:
Contrl.prototype.EvaluateStatement = function(acVal, cfVal) {
var cv = parseFloat(cfVal).toFixed(2);
var av = parseFloat(acVal).toFixed(2);
if( av < cv) // do some thing
}
Run Code Online (Sandbox Code Playgroud)
当我比较浮点数av=7.00和cv=12.00结果7.00<12.00是false!
有什么想法吗?
当我使用math.cos()和math.sin()函数时,我的python解释器表现得很时髦.例如,如果我在计算器上执行此操作:
cos(35)*15+9 = 21.28728066
sin(35)*15+9 = 17.60364655
Run Code Online (Sandbox Code Playgroud)
但是当我在python上执行此操作时(3.2和2.7)
>>> import math
>>> math.cos(35)*15+9
-4.5553830763726015
>>> import math
>>> math.sin(35)*15+9
2.577259957557734
Run Code Online (Sandbox Code Playgroud)
为什么会这样?
编辑:为了以防万一,你如何将Python中的Radian更改为度?