- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 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 # 0
Какой багор)))
j123123 # 0 ⇈
bormand # 0 ⇈
guest # 0 ⇈
https://en.wikipedia.org/wiki/Strictfp
guest # 0 ⇈
Desktop # 0
но флоаты не нужны
guest # 0 ⇈
https://en.wikipedia.org/wiki/Multiply%E2%80%93accumulate_operation#Fused_multiply%E2%80%93add
bormand # 0
MAKAKA # 0 ⇈
moderat0r # 0
Steve_Brown # 0