You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In this notebook it is demonstrated that Float128 is about 4 times faster than BigFloat with 113 bit precision
17
-
(the precision of Float128).
16
+
In this notebook it is demonstrated that `Float128` is about 4 times faster than `BigFloat` with 113 bit precision
17
+
(the precision of `Float128`).
18
+
19
+
##Bugs
20
+
+`ccall` does not treat parameters and returning values of Julia type `Float128` as C type `__float128` as it would
21
+
be appropriate.
22
+
23
+
Unfortunately, this is a bug which cannot easily be fixed.
24
+
The [x86-64 Application Binary Interface](http://www.x86-64.org/documentation.html)
25
+
says that parameters and returning values of type `__float128` should be passed preferably in the (128 bit long) SSE floating point registers `xmm0`,...,`xmm7`. However, for the datatype `Float128` defined as
26
+
```julia
27
+
bitstype 128 Float128 <:AbstractFloat
28
+
```
29
+
in [Quadmath.jl](https://github.com/HaraldHofstaetter/Quadmath.jl/blob/master/src/Quadmath.jl),
30
+
`ccall` seems to use the same calling convention as for something like
31
+
```c
32
+
struct{
33
+
uint64_t u0;
34
+
uint64_t u1;
35
+
} words64;
36
+
```
37
+
in C.
38
+
39
+
A remedy is to implement a wrapper functionfor each external function with `__float128` parameters or return values,
40
+
that you want to call by `ccall`. Such a wrapper takes parameters `x` of type `myfloat128` declared as
41
+
```c
42
+
typedef union
43
+
{
44
+
__float128 value;
45
+
46
+
struct{
47
+
uint64_t u0;
48
+
uint64_t u1;
49
+
} words64;
50
+
} myfloat128;
51
+
```
52
+
and calls the original function with `x.value` as actual parameter for the coorresponding formal parameter of type
0 commit comments