Closed pthom closed 2 years ago
I was under the impression that long double
was just double
for many architectures and compilers, and figured very folks would be using it otherwise. If anything, I'd like to remove uncommon supported types rather than add more (each additional type we support adds significantly to compile times).
Have you tried instantiating these functions with a long double
template argument? I think it would work fine, and if so then I would recommend you make these changes to implot_items.cpp
in your own fork.
Have you tried instantiating these functions with a long double template argument? I think it would work fine, and if so then I would recommend you make these changes to implot_items.cpp in your own fork.
Yes it works.
Note: the fact there is no standard for base type in C/C++ does not make it easy.
I was under the impression that long double was just double for many architectures and compilers, and figured very folks would be using it otherwise.
Actually, I saw that long double is 16 bytes with gcc and clang x86_64. Maybe this is what enables numpy to offer the float128 type (quote from numpy: "np.float128 provide only as much precision as np.longdouble, that is, 80 bits on most x86 machines and 64 bits in standard Windows builds.")
If you want to play, you can experiment with this demo on compiler explorer, which produced this:
x64 msvc2019
sizeof(char) = 1
sizeof(short) = 2
sizeof(int) = 4
sizeof(unsigned int) = 4
sizeof(long) = 4
sizeof(unsigned long) = 4
sizeof(long long) = 8
sizeof(float) = 4
sizeof(double) = 8
sizeof(long double) = 8
x86 msvc2019
sizeof(char) = 1
sizeof(short) = 2
sizeof(int) = 4
sizeof(unsigned int) = 4
sizeof(long) = 4
sizeof(unsigned long) = 4
sizeof(long long) = 8
sizeof(float) = 4
sizeof(double) = 8
sizeof(long double) = 8
x86_64 clang 14.0
sizeof(char) = 1
sizeof(short) = 2
sizeof(int) = 4
sizeof(unsigned int) = 4
sizeof(long) = 8
sizeof(unsigned long) = 8
sizeof(long long) = 8
sizeof(float) = 4
sizeof(double) = 8
sizeof(long double) = 16
x86_64 gcc(trunk)
sizeof(char) = 1
sizeof(short) = 2
sizeof(int) = 4
sizeof(unsigned int) = 4
sizeof(long) = 8
sizeof(unsigned long) = 8
sizeof(long long) = 8
sizeof(float) = 4
sizeof(double) = 8
sizeof(long double) = 16
If supported I guess that sort of stuff we be better under a compile-time define ?
@ocornut , @epezent : thanks for your inputs. I propose a fix in this related PR
Hello,
I found that the various IMPLOT_TMP template implementations do not support
long double
.See extract from
implot_items.cpp
:"long double" is rather unusual, but it might help some people.
On my side, I found a way to work without it, so there is no real need for me. Feel free to close if you think it is not worth the effort.
Thanks!