Перевод float в int. Неверный результат - C (СИ)
Формулировка задачи:
#include <stdio.h>
#include <conio.h>
#include <string.h>
int main()
{
float D;
int Y;
D=1189100068;
printf("D=%f\n",D);
memcpy(&Y,&D,4);
printf("Y=%d\n",Y);
printf("D=%f\n",D);
getch();
return 0;
}Решение задачи: «Перевод float в int. Неверный результат»
textual
Листинг программы
#include <stdio.h>
#include <conio.h>
#include <string.h>
int main()
{
double D,Y;
D = 1189100068;
printf("D=%f\n", D);
memcpy(&Y, &D, 4);
printf("Y=%f\n", Y);
printf("D=%f\n", D);
_getch();
return 0;
}