Live data from Hacker News

LibBF – a small library to handle arbitrary precision floating point numbers

bellard.org

31–40 of 63 posts

Re: LibBF – a small library to handle arbitrary precision floating point numbers

#31
post #16

This is perfect for jq[0]. [0] https://github.com/stedolan/jq

Why does jq need arbitrary precision floating-point numbers?

The most FAQ / most filed issue for jq may well be that IEEE754 sucks. Users are frequently surprised by IEEE754 issues.

Re: LibBF – a small library to handle arbitrary precision floating point numbers

#32
post #28

Earlier quoted context omitted.

As you said, this is equivalent to factorisation in terms of complexity. The Wikipedia article[0] on the subject does a good job of summarising the details of this in the section "Other properties of repeatend lengths". For a simple answer, the lengths are bounded above by Euler's totient function [1] (the sum of factors) of the denominator. Any tighter bounds depend on the specific primes in the factorisation. Note…

That Wikipedia article on repeating decimals is probably where I started looking into it, but the article is somewhat weird. For many problems Wikipedia articles say we know this and that but those other things are still unknown, this article has a lot of information but does not talk about unknown things at all. The length of the repeating fractional part of 1 / n divides φ(n)...and then nothing. Is this all we know…

MathWorld is often a decent resource for finding this kind of information: " rel="nofollow">http://mathworld.wolfram.com/DecimalPeriod.html>, but it's often difficult to arrive at those pages if you don't have any idea where to start.

Re: LibBF – a small library to handle arbitrary precision floating point numbers

#33
post #28

Earlier quoted context omitted.

As you said, this is equivalent to factorisation in terms of complexity. The Wikipedia article[0] on the subject does a good job of summarising the details of this in the section "Other properties of repeatend lengths". For a simple answer, the lengths are bounded above by Euler's totient function [1] (the sum of factors) of the denominator. Any tighter bounds depend on the specific primes in the factorisation. Note…

That Wikipedia article on repeating decimals is probably where I started looking into it, but the article is somewhat weird. For many problems Wikipedia articles say we know this and that but those other things are still unknown, this article has a lot of information but does not talk about unknown things at all. The length of the repeating fractional part of 1 / n divides φ(n)...and then nothing. Is this all we know…

The repeating digits in the fractional part are essentially the output of a linear congruence random number generator. Finding the period is almost the same as determining the order of an element of the state space, but by chance you might get a shorter repetition that fits into the longer one.

Finding the order of an element in a group is a hard problem on par with factoring http://mathworld.wolfram.com/GroupOrder.html

I'm not sure about cases where the state space doesn't form a multiplicative group, but I doubt that it gets much easier.

Re: LibBF – a small library to handle arbitrary precision floating point numbers

#34
post #28

Earlier quoted context omitted.

That Wikipedia article on repeating decimals is probably where I started looking into it, but the article is somewhat weird. For many problems Wikipedia articles say we know this and that but those other things are still unknown, this article has a lot of information but does not talk about unknown things at all. The length of the repeating fractional part of 1 / n divides φ(n)...and then nothing. Is this all we know…

MathWorld is often a decent resource for finding this kind of information: " rel="nofollow">http://mathworld.wolfram.com/DecimalPeriod.html> , but it's often difficult to arrive at those pages if you don't have any idea where to start.

There's an extra > at the end of your link.

Re: LibBF – a small library to handle arbitrary precision floating point numbers

#35
post #28

Earlier quoted context omitted.

That Wikipedia article on repeating decimals is probably where I started looking into it, but the article is somewhat weird. For many problems Wikipedia articles say we know this and that but those other things are still unknown, this article has a lot of information but does not talk about unknown things at all. The length of the repeating fractional part of 1 / n divides φ(n)...and then nothing. Is this all we know…

MathWorld is often a decent resource for finding this kind of information: " rel="nofollow">http://mathworld.wolfram.com/DecimalPeriod.html> , but it's often difficult to arrive at those pages if you don't have any idea where to start.

I certainly also looked through MathWorld but I failed to make some - in hindsight - rather obvious connections or did not pay enough attention. I certainly knew what the discrete logarithm problem is and that it is hard but I did not realize until a few minutes ago that finding the multiplicative order is just that only with a different name. And now being aware of that the MathWorld article spells exactly this out in a way that it seems impossible to miss.

Re: LibBF – a small library to handle arbitrary precision floating point numbers

#37
post #20
post #16

Earlier quoted context omitted.

Why does jq need arbitrary precision floating-point numbers?

Because JSON's spec defines a "number" as an arbitrary-precision floating point number, no limit on how many digits can be before or after the decimal or on what positive or negative integers you can put after the "e". Despite the name "JavaScript Object Notation," it does not inherit JavaScript's traditional interpretation that a "number" is an IEEE 754 double. (JSON also does not permit infinities or NaN, which Jav…

Wouldn't jq be better served by a library supporting arbitrary precision decimal values? LibBF is for base-2 floating point.

Re: LibBF – a small library to handle arbitrary precision floating point numbers

#38
post #21

For those that don't know, Fabrice Bellard is the author of ffmpeg [1], the tiny c compiler (tcc) [2], linux in the browser [3] among many others [4]. Does anyone know how LibBF stacks up against GMP? [5] [1] http://ffmpeg.org/ [2] https://bellard.org/tcc/ [3] https://bellard.org/jslinux/ [4] https://bellard.org/ [5] https://en.wikipedia.org/wiki/GNU_Multiple_Precision_Arithme...

Fabrice Bellard is so outrageously awesome, it makes me wonder why I bother to exist.

I like the stuff he did for software radio decoding too.

Re: LibBF – a small library to handle arbitrary precision floating point numbers

#39
post #27
post #22

Earlier quoted context omitted.

[6] https://www.qemu.org/

God damn, as if the others were not enough... Can someone confirm that this dude is a human?

He also built a home brew 3G and then LTE base station, iirc.

Re: LibBF – a small library to handle arbitrary precision floating point numbers

#40
post #27
post #22

Earlier quoted context omitted.

[6] https://www.qemu.org/

God damn, as if the others were not enough... Can someone confirm that this dude is a human?

Can confirm that he is an alien--we're just not sure if extraterrestrial or extradimensional.
Post reply on HN