Is this normal or a bug ?
Mehdi
randomemail at gmail.com
Mon Jul 3 08:24:22 UTC 2023
Hello, d community! I am currently exploring the possibilities of
interoperability between C++ and D. While conducting some tests,
I came across an interesting case. Here is the C++ code snippet:
```cpp
float float_test(float x, float y){
return x+y;
}
```
And here is the corresponding D code:
```d
extern (C++) float float_test(float x, float y);
{
assert(10.1 + 20.6 == float_test(10.1, 20.6));
}
```
Unfortunately, the assert statement fails in this case. I'm
wondering if this discrepancy is due to the different float
representations, a bug, or if I'm doing something wrong. Any
insights would be greatly appreciated!
More information about the Digitalmars-d
mailing list