我只是进行汇编语言编程才发现我的代码没有用。我浏览了代码,发现了我对Endianess的理解问题。
我的系统是Little Endian
,我的代码如下:
lbDest:
.byte 0x0000
.byte 0x0000
.word 0x0000
.word 0x0000
以上是我应该将值复制到的目的地,以下是要复制的来源,
lbSrc:
.byte 0x00
.byte 0x00
.long 0x00000001
.long 0x00
我将值从Source复制到Destination的代码如下:
movw $lbSrc, %si
movw $lbDest, %di
lbTempLoop:
addw $0x02, %si
addw $0x02, %di
movw (%si), %ax
movw %ax, (%di)
loop lbTempLoop
概念
这个概念就是这样,从.long
复制lbSrc
值并将其放在两个单词.word
中,然后再取出单词,我应该能够得到相同的值在.long
。
movl
之类的说明不适合。操作系统:Ubuntu
汇编程序:GNU AS
Endianess:Little Endian
由于
答案 0 :(得分:2)
循环的两次迭代将产生以下结果:
import numpy as np
import pandas as pd
def call_price ( precio, strike, time, volat):
r = 0.02 # riskless short rate
I = 100000 # number of simulations
z = np.random.standard_normal(I) # pseudorandom numbers
ST = precio * np.exp((r - 0.5 * volat ** 2) * time + volat * np.sqrt(time) * z)
hT = np.maximum(ST - strike, 0) # inner values at maturity
C0 = np.exp(-r * time) * np.sum(hT) / I # Monte Carlo estimator
return (C0)
precios = [2300,2400,2500,2600,2700,2800]
for i in range(6):
precio_call = call_price(precios[i],2400,0.333,0.09)
spread = precios[i] - precio_call
print(spread)
#df = pd.DataFrame(spread) #it doesn't work
进一步的迭代将开始覆盖未在此处定义的目标中的内存!
lbDest:
.byte 0x0000
.byte 0x0000
.word 0x0000 This will recieve a value of 1 (low word of the long)
.word 0x0000 This will recieve a value of 0 (high word of the long)