Короче хотел воспроизвести ошибку, по которой падает Checkit в бенчмарке с
Код:
run-time error M6104: MATH
- floating point error: overflow
checkit, согласно http://thomas.fach-pedersen.net/compiler-copyrights.txt , скомпилен Microsoft C 5.1, о чем говорит строка с копирайтом в EXE:
Код:
MS Run-Time Library - Copyright (c) 1988, Microsoft Corp\x11
Установил MS C 5.1 (еле нашел), компилял какую-то писькомерку, перемножающую массив рандомных чисел несколько раз:
Код:
/*
* ATFLOAT -- PC Tech Journal Floating-Point Performance Test
*
* Version 1.01
* Last modified 11/04/86
* Copyright (c) 1986, Ziff Communications Company
* Program by: Paul Pierce, Ted Forgeron, Steven Armbrust
*
* Measures the time it takes to multiply two matrices of
* double-precision floating-point numbers and compares it
* to the time it takes an 8MHz PC/AT with an 80287 math
* coprocessor to do the same.
*/
#include <stdio.h>
#include <time.h>
/* Number of iterations the test runs for. */
#define TRIALS 10
/* Dimension of the matrix */
#define SIZE 20
unsigned rand();
double drand()
{
return (double)rand() / 32767;
}
double a[SIZE][SIZE];
double b[SIZE][SIZE];
main()
{
int i;
register j, k;
int n;
unsigned long start;
unsigned long total;
unsigned trials;
double t;
trials = TRIALS;
/*
* Fill matrix with random numbers.
*/
for (i = 0; i < SIZE; i++)
for (j = 0; j < SIZE; j++)
a[i][j] = drand();
/*
* Repeatedly multiply the matrices and
* report the relative and absolute times.
*/
start = time(NULL);
printf("\nATFLOAT -- PC Tech Journal AT Floating-Point");
printf(" Performance Test\n");
printf("Version 1.01, Copyright (c) 1986 Ziff ");
printf("Communications Co.\n");
printf("\nThis test runs for %d iterations ...\n", trials);
for (n = 1; n <= trials; n++) {
printf("%d\r", n);
for (i = 0; i < SIZE; i++) {
for (j = 0; j < SIZE; j++) {
t = 0;
for (k = 0; k < SIZE; k++)
t += a[k][j] * a[i][k];
b[i][j] = t;
}
}
}
total = time(NULL) - start;
printf("\rElapsed time is %ld seconds.\n\n", total, trials);
printf("Floating-point performance index relative\n");
printf("to 8MHz IBM PC/AT with 80287 = %2.1f\n",
94.0 / (float) total);
}
Значит у MS C 5.1 есть несколько вариантов как работать с вещественными:
Код:
/IFPa Produces floating-point calls and selects alternate math library
/IFPc Produces floating-point calls and selects emulator library
/IFPc87 Produces floating-point calls and selects 8087/80287/80387 library
/IFPi Produces in-line instructions and selects emulator library
/IFPi87 Produces in-line instructions and selects 8087/80287/80387 library.
Я пробовал компилить с /FPa, /FPc и соответственно с /FPi, который по дефолту. Все три варианта отрабатывают без ошибок
Воспроизвести не смог.