On Thu, Dec 7, 2023 at 11:27 PM Jordan LeDoux <jordan.led...@gmail.com>
wrote:

You are going to run into some very difficult corners on this one. For the
> last... 8 years i guess? I have been working on an arbitrary precision
> library for PHP in userland. It utilizes BCMath, ext-decimal, and GMP,
> depending on what is installed and what kind of operation you are
> performing.
>
> So, the functions that currently accept floats include functions such as
> `sin()` or `atan()`. These functions are not at all trivial to do to
> arbitrary precision. In fact, the VAST majority of the work I have done on
> my library has been to handle cases like "What do I do if the user wants
> 2.921 ** 4.293810472934854?" or "How will I guarantee the precision that
> the user requested for `tan()` in an efficient way?"
>
> Now, libmpdec is going to actually have implementations for most of this
> stuff that you can call directly, but if the PHP function `sin()` isn't
> capable of *outputting* a `decimal`, then this isn't really that much of an
> improvement over the current situation. I mean, it's still something I
> would support, but that's the area where some help from the engine goes a
> VERY long way.
>

In my proposal, builtin functions are capable of returning decimals if
they're fed with decimals.


You're probably also going to need a way for a user to grab certain
> constants to a given precision. I would think e and pi at the least.
>
> I have a lot of experience working on this problem space in PHP, and am
> definitely willing to help. I looked into doing a libmpdec PHP integration
> several years ago, but decided that voters were unlikely to give it a fair
> shot, and so decided against it. If you're willing to try and roll the ball
> up the hill though, I'll definitely help you.
>

Unfortunately, I'm not an expert in precise math. I definitely need help
from experts like you. I appreciate your readiness.

I understand that there are a lot of edge cases. I would propose to
implement basics at first and then decide what to do with edge cases.

Reply via email to