开发者

What is it the estimate of Moore's law, a program to do this

开发者 https://www.devze.com 2023-02-15 06:01 出处:网络
In 1988, the number of transistors in the Intel 386 SX microprocessor was 275,000. What were the transistor counts of the Pentium IIIntel microprocessor in 1997?

In 1988, the number of transistors in the Intel 386 SX microprocessor was 275,000. What were the transistor counts of the Pentium II Intel microprocessor in 1997?

If Intel doubles the number of transistors every two years, the new processor would have

Pn = 275,000 * 2^n (where n = 9/2 = 4.5)    
   = 275,000 * 22.63
   = 6.2 million transistors

So How would be a code for this using C,开发者_开发问答 C++ or java...


Indeed. Moore changed his projection in 1975 to doubling the number of transistors every two years.

#include <stdio.h>
#include <math.h>

int main () {
    double transistors = 275000;
    double years = 1997-1988;
    printf("%f", transistors*pow(2.0,years/2)); // 6222539.674442
    getch();
    return 0;
}


In C:

#include <stdio.h>
#include <math.h>

#define BASELINE_CPU_YEAR 1988
#define BASELINE_CPU_TRANSISTORS 275000

/* Estimate transistor count for Intel CPUs for a given year
 * based on Moore's law */
double moores_law(int year) {
        float year_offset = (year - BASELINE_CPU_YEAR) / 2.0;
        return BASELINE_CPU_TRANSISTORS * pow(2, year_offset);
}

int main () {
        int year = 1997;
        printf("Moore's law projects a %d CPU would have %.2f transistors.\n", 
                year, moores_law(year));

        return 0;
}


In java or c# you can do something like this

int year = 2010; //for example

double  P0 = 275000;
float n = ((float)year - 1988) / 2; //1988 -> base year

double Pn = P0 * (Math.Pow(2, n));
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号