Thread Links Date Links
Thread Prev Thread Next Thread Index Date Prev Date Next Date Index

Re: Another proposal for a "split" function to complement "mid"



John Pryce wrote, replying to Vladik's efficiency concerns:
> Earlier discussion suggested a good method to find a split point in [a,b]
> would behave like the arithmetic mean for smallish numbers, and like
> geometric mean for larger numbers of the same sign.  asinh is the only
> elementary function that gives a mapping which implements that, being like
> log(x) for x >> 1, like x for |x| small, like -log(-x) for x << -1.  That's
> why I chose it.  But a function with similar behaviour would do, if it and
> its inverse are cheap to evaluate and guaranteed monotone.

If you want a Level 1 definition, this seems best indeed.  But if we loosen
the Level 2 requirement to provide a function with the same overall behaviour,
but otherwise unspecified, the most efficient one at Level 2 works directly
on the binary representation, by flipping some bits and taking the integer
arithmetic mean.  Formally it means converting to sortable, averaging, then
converting back to FP.  This would work for DFP as well as for BFP (the DFP
sortable format is a bit more complicated, but still implementable with good
performance -- certainly better than a hyperbolic function).

(You still need the cutoff -- probably L=1 is just fine -- near zero.)

Michel.

P.S.  I can imagine cases that work around poles where a cutoff is NOT
      desired, and one wants to split geometrically all the way.
---Sent: 2012-03-18 23:13:29 UTC