Live data from Hacker News

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

github.com

31–40 of 42 posts

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

#35
> std::numeric_limits>::MAX()

Surely you mean ::max()?

> is_fundamental::value et al.

Besides the undefined behavior issue mentioned by others, none of these are syntactially correct.

> #include "fas/stream.hpp>

Ok then...

> The Stl's std::numeric_limits is required the limits of the specified types for mantissa and exponent.

Missing a word? Also, the STL [0] does not have std::numeric_limits, perhaps you mean the C++ standard library (or stdlib for short).

[0] https://en.wikipedia.org/wiki/Standard_Template_Library

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

#36

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.

Sounds like you prefer copyleft licenses. I suggest MPL-2.0 or some variety of (L)GPL as they are the most well-known ones.

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

#38
post #34

Earlier quoted context omitted.

GMP doesn't do arbitrary exponents.

Indeed, thanks.

Slight correction, while the exponent is indeed fixed, it is larger than a f32/f64 exponent: https://gmplib.org/manual/Floating_002dpoint-Functions

However, this is not exposed in all GMP wrappers.

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

#39
post #19

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

Removed it.

You should put the copyright notice back and (optionally) add a license. Removing the notice from your code changes nothing, that does not waive or remove your copyright. You still have the copyrights to your code by default, and you should. Don’t react to silly comments on the internet by feeding them.

If you really don’t want the copyrights, you can use the CC0 license from Creative Commons. That would allow people to use your code any way they want with no restrictions (which means they are legally allowed to use it commercially, remove the author notice, re-license modified versions, redistribute the code, etc.). However, you do not need to waive your copyrights entirely in order to license your code as open source. You can choose between a variety of licensing terms, while still being very open and liberal about sharing. Try the Creative Commons license chooser https://chooser-beta.creativecommons.org/. Or look through open source licenses. Standardized SPDX IDs are gaining popularity since it helps with some automation workflows. https://opensource.org/licenses https://spdx.org/licenses/

Since you left the author note, maybe you would like an attribution license like one of these popular choices (both available with SPDX IDs): https://opensource.org/license/bsd-3-clause https://creativecommons.org/licenses/by-sa/4.0/

If you don’t add a license, then your code remains under strict copyright and people are not legally allowed to use it in their own projects, regardless of whether you have a copyright notice in the comments. Leaving out the copyright notice might be confusing, especially given this thread. The recommended practice is to include both the copyright notice and the license in comments or a license file.

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

#40
post #34

Earlier quoted context omitted.

Indeed, thanks.

Slight correction, while the exponent is indeed fixed, it is larger than a f32/f64 exponent: https://gmplib.org/manual/Floating_002dpoint-Functions However, this is not exposed in all GMP wrappers.

If I understand this correctly GMP has a flexible mantissa with no limitations during runtime.

In fas you have to specify the sizes (of mantissa and exponent) during compile time. So the size of this type is fixed. Thus, there is no heap involved.

Post reply on HN