Live data from Hacker News

Show HN: Floating point arithmetic types in C++ for any size and any base

github.com

21–30 of 42 posts

Re: Show HN: Floating point arithmetic types in C++ for any size and any base

#21
post #7

Consider dropping the specializations for the type traits, given that it's undefined behavior: https://en.cppreference.com/w/cpp/types/is_fundamental https://en.cppreference.com/w/cpp/types/is_floating_point https://en.cppreference.com/w/cpp/types/is_arithmetic https://en.cppreference.com/w/cpp/types/is_scalar https://en.cppreference.com/w/cpp/types/is_object

Why is std::is_object even specialized here? Isn't it always true regardless?

Re: Show HN: Floating point arithmetic types in C++ for any size and any base

#22

Earlier quoted context omitted.

Technically, you're not supposed to add your own specialisations to the `std` namespace

In general this isn’t true (i guess it is in this specific context). For example I believe it’s totally expected to specialize std hash

I’ve also done this with hash… though given the footguns scattered about, I wouldn’t be surprised if it broke the spec.

Re: Show HN: Floating point arithmetic types in C++ for any size and any base

#26
post #19

It's copyrighted so I should not even look at it, and therefore not comment on it.

It's copyrighted, but nothing stops you from looking at it. It's akin to looking a t a mural painted at someone's house. You can also comment as long as you don't post snippets of the code (except for when fair use is applicable).

Re: Show HN: Floating point arithmetic types in C++ for any size and any base

#27
post #22

Earlier quoted context omitted.

In general this isn’t true (i guess it is in this specific context). For example I believe it’s totally expected to specialize std hash

I’ve also done this with hash… though given the footguns scattered about, I wouldn’t be surprised if it broke the spec.

That is a completely intended way to use std::hash, along with a few other functions like std::tuple_size and std::tuple_element.

Re: Show HN: Floating point arithmetic types in C++ for any size and any base

#28
post #19

It's copyrighted so I should not even look at it, and therefore not comment on it.

All creative works are copyrighted by default in the U.S. and any countries adhering to the Berne convention, unless copyrights are explicitly waived (which is not always an option). This is true regardless of what copyright notices exist, so by that standard you shouldn’t look at or comment on anything. ;) But, it’s legal to look at something copyrighted, you just can’t copy & distribute it. Just curious, did you mean that it lacks an open source license and you only look at open source, or was this just a joke that went sideways, or something else?

Re: Show HN: Floating point arithmetic types in C++ for any size and any base

#29

No LICENSE. Have you thought about adding one?

Somebody wants to use it? :D I thought about something like where people can use it but have to make changed public. I am just curious, what should be changed. But I dont think there is actually a real world use case.
Post reply on HN