我有一个考题,我必须使用Black和Schole公式找到看跌期权和看涨期权的增量。
我找到了一个为我做这件事的网站,所以我在代码中找到了这个函数:
getDelta: function(spot, strike, volatility, riskfree, dividendy) {
var self = this;
var d1 = self.getD1(spot, strike, volatility, riskfree, dividendy);
var Nd1 = phi(d1);
// Interesting line
var result = M
我有下面这段代码
public class direction do(direction)
if(istrue) {
left = do(left);
} else {
right = do(right);
}
}
我想知道有没有什么办法可以缩短这段时间。我尝试使用三元运算符,但遇到了一些困难。有什么建议吗?
纳克风格的错误。角不允许三值算子吗?
我看到一个这样的帖子,显示角确实支持三元操作符,但不确定为什么它对我不起作用。
Error: [$parse:syntax] http://errors.angularjs.org/1.2.27/$parse/syntax?p0=%3A&p1=is%20an%20unexpected%20token&p2=6&p3=color%3Agray&p4=%3Agray
at Error (native)
at http://localhost/capstar/res/libs/angular/angular.min
下面的c语句没有通过编译器.error作为“返回前的预期表达式”。
int max( int a,int b)
{
a>b?return a:return b;
}
是的,我知道我可以写这篇文章来寻找max as
return a>b?a: b;
这是非常好的,并将完美地运行。但我的问题是,第一个code.why到底有什么问题,我们不能在三元引导器中使用return吗,尽管我们可以很容易地在那里使用函数调用?
提前感谢!
我可以将三进制运算符传递给函数的参数吗? int test(int a, int b, int c) {
return a+b+c;
}
int nn = 0;
int a = test(1, 1 | (2 ? nn : 0), 1); // test(1, 1 | 0, 1)
n = 1;
a = test(1, 1 | (2 ? nn : 0), 1); // test(1, 1 | 2, 1)