- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
#include <stdio.h>
#include <string.h>
double emit_fmadd(double a, double b, double c) __attribute ((noinline));
double emit_fmadd(double a, double b, double c)
{
return a*b+c;
}
int main(void)
{
double a = 10.0000;
double b = 1.00001;
double c = 1.001;
double res = emit_fmadd(a,b,c);
unsigned char arr[sizeof(res)];
memcpy(arr, &res, sizeof(res));
for (int i = 0; i < sizeof(res); i++)
{
printf("%.2x ", arr[i]);
}
printf("\n");
}
/*
gcc -O3 -march=skylake
emit_fmadd:
vfmadd132sd xmm0, xmm2, xmm1
ret
gcc -O3 -march=x86-64
emit_fmadd:
mulsd xmm0, xmm1
addsd xmm0, xmm2
ret
*/
j123123 06.03.2021 18:12 # 0
Какой багор)))
j123123 06.03.2021 18:14 # 0
bormand 06.03.2021 18:43 # 0
guest6 06.03.2021 18:47 # 0
https://en.wikipedia.org/wiki/Strictfp
guest6 06.03.2021 18:50 # 0
Desktop 06.03.2021 18:22 # 0
но флоаты не нужны
guest6 06.03.2021 18:25 # 0
https://en.wikipedia.org/wiki/Multiply%E2%80%93accumulate_operation#Fu sed_multiply%E2%80%93add
bormand 06.03.2021 18:34 # 0
MAKAKA 06.03.2021 18:36 # 0
moderat0r 06.03.2021 23:41 # 0
Steve_Brown 09.03.2021 13:56 # 0