필터 지우기
필터 지우기

Processing Time of Multiplicatoin and Addition

조회 수: 2 (최근 30일)
Ali Abdollahi
Ali Abdollahi 2012년 1월 12일
We know that the processing of a multiplication is by far greater than that of addition.
I did this test.
For testing the requeired clock cycles for an addition I wrote the following program.
clc
clear
N = 10^8;
tic for i=1:N j=i+i; end processing_time = toc;
av_time = processing_time/N;
clk_period = 1/(3.4*10^9); % computer clock period time = 1/f where f = 3.4 GHz
av_time2clk_period = av_time/clk_period
Then I changed j= i+i ; to j = i*i to see how many cycles a multiplication takes time. Amazingly both addition and multiplication result in the same processing time. Why?

채택된 답변

Bill Winter
Bill Winter 2012년 1월 12일

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Testing Frameworks에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by