2012年3月9日 星期五

IRR(Internal Rate of Return)公式

float c,x;
Discount;
float Low=0, High=1;
int n;
scanf("%f",&c);
scanf("%f",&x);
scanf("%d",&n);
while(High-Low>=0.0001){
  float Middle=(Low+High)/2;
  float Value=0;

  for(inti=1;i<=n;i=i+1){
    Discount=1;
    for(intj=1;j<=i;j++){
      Discount=Discount/(1+Middle);
    }
  Value=Value+Discount*c;
  }

  Value=Value-x;
  if(Value>0){ Low=Middle;}else{High=Middle;}
}
printf("Yieldrate=%f",High);

2012年1月1日 星期日

主計處100/11/24GDP年增率預估

主計處100/11/24GDP年增率預估
2011年(f) 4.51 
Ⅰ(r) 6.62 
Ⅱ(r) 4.52
Ⅲ(p) 3.42
Ⅳ(f) 3.69 

2012年(f) 4.19
Ⅰ(f) 2.67
Ⅱ(f) 3.64 
Ⅲ(f) 4.99 
Ⅳ(f) 5.31

2011年8月19日 星期五

主計處最新GDP年增率預估

主計處最新GDP年增率預估
2011年(f) 4.81
Ⅰ(r) 6.16
Ⅱ(p) 5.02
Ⅲ(f) 3.48
Ⅳ(f) 4.71

2012年(f) 4.58
Ⅰ(f) 4.01
Ⅱ(f) 3.77
Ⅲ(f) 5.20
Ⅳ(f) 5.25

2011年7月13日 星期三

Errno.h

0 Error 0.  Not used.

1 EPERM Operation not permitted.  An attempt was made to perform an oper-
ation limited to processes with appropriate privileges or to the
owner of a file or other resources.

2 ENOENT No such file or directory.  A component of a specified pathname
did not exist, or the pathname was an empty string.

3 ESRCH No such process.  No process could be found corresponding to that
specified by the given process ID.

4 EINTR Interrupted function call.  An asynchronous signal (such as
SIGINT or SIGQUIT) was caught by the process during the execution
of an interruptible function.  If the signal handler performs a
normal return, the interrupted function call will seem to have
returned the error condition.

5 EIO Input/output error.  Some physical input or output error occurred.
This error will not be reported until a subsequent operation on
the same file descriptor and may be lost (over written) by any
subsequent errors.

2011年5月5日 星期四

mpeg4-generic parsing for AAC over RFC3640

轉貼文章


Preface



Reference
  • RFC3640
  • ISO/IEC 14496-3
  • ISO/IEC 13818-7, MPEG-2 Advanced Coding (AAC)
AU-header structure


AAC frame in AU-header


!!NOTES:
1) DVB-H supports High bit-rate AAC while streaming
2) The AU-headers are configured using MIME format parameters
may be empty. Don’t know how to know it according to SDP description??
(if anyone knows the answer, please let me know..:P)

3) If AAC frames are carried over RFC3640, ADTS header is needed for each AAC frame
for AAC decoder using the following info.

AAC ADTS 檔頭分析

adts_fixed_header()

{
syncword; 12 bits

ID; 1 bit

layer; 2 bits

protection_absent; 1 bit

profile; 2 bits

sampling_frequency_index; 4 bits

private_bit; 1 bit

channel_configuration; 3 bits

frame_length; 13 bits

adts_buffer_fullness; 11 bits

number_of_raw_data_blocks_in_frame; 2 bits

}

syncword 固定字串The bit string ‘1111 1111 1111’ -> 0xFFF,為一個ADTS檔頭的開始。

ID MPEG 標誌, 通常為1

layer Indicates which layer is used. Set to ‘00’

protection_absent 表示是否有錯誤碼校正機制,設1為是

profile 表示使用哪個等級的AAC,如01 Low Complexity(LC)--- AACLC

sampling_frequency_index sampling frequeny [Hz]

0x0 96000

0x1 88200

0x2 64000

0x3 48000

0x4 44100

0x5 32000

0x6 24000

0x7 22050

0x8 16000

0x9 2000

0xa 11025

0xb 8000

0xc reserved

0xd reserved

0xe reserved

0xf reserved

channel_configuration channel數量

frame_length 代表一個AAC Frame的長度包括ADTS檔頭和raw data block.

adts_buffer_fullness 固定值為0x7FF 說明frame rate是可變動的

number_of_raw_data_blocks_in_frame

表示AAC Frame中有number_of_raw_data_blocks_in_frame + 個AAC raw data.

所以說number_of_raw_data_blocks_in_frame == 0 表示說AAC Frame中有一個AAC raw block並不是沒有。


2010年11月3日 星期三

投資策略(1)--橫台整理等待突破



通常一檔股票下跌後,會經過打底的狀況,以便主力在這之中吸取籌碼
這個時候看K線會看到一個最低點以及一段整理的區間
而整理區間至少要出現三次區間的低點才能稱為整理區間
那麼就可以以最低點為停損點,整理區間的低點為買點,然後等待突破區間高點即可
整理的越久,向上幅度就越大,而且停損所能承受的損失都能清楚的定義出來
這種策略到線再都一值很好用,因為當知道損失大概是多少的時候,
在跌的時候心情就不會那麼不知所措