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`).
18
-
19
-
##Bugs
20
-
+`ccall` does not treat parameters and returning values of Julia type `Float128` properly as C type `__float128`.
21
-
22
-
Unfortunately, this is a bug which cannot easily be fixed without modifying the internals of Julia.
23
-
The [x86-64 Application Binary Interface](http://www.x86-64.org/documentation.html)
24
-
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
25
-
```julia
26
-
bitstype 128 Float128 <:AbstractFloat
27
-
```
28
-
in [Quadmath.jl](https://github.com/HaraldHofstaetter/Quadmath.jl/blob/master/src/Quadmath.jl),
29
-
`ccall` seems to use the same calling convention as for something like
30
-
```c
31
-
struct{
32
-
uint64_t u0;
33
-
uint64_t u1;
34
-
} words64;
35
-
```
36
-
in C.
37
-
38
-
As a remedy, you can implement a wrapper functionfor each external function with `__float128` parameters
39
-
or return values, that you want to call with `ccall`. Such a wrapper takes parameters `x` of type
40
-
`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 corresponding formal parameter of type
0 commit comments