On Mon, Nov 5, 2012 at 3:13 PM, Otto Moerbeek <[email protected]> wrote: > On Sun, Nov 04, 2012 at 03:06:14PM -0430, Andres Perera wrote: > >> On Sun, Nov 4, 2012 at 1:41 PM, Otto Moerbeek <[email protected]> wrote: >> > >> > It's easy to create a trunc function. Yes it will needs scale setting >> > en resetting, but I do not see that as a problem. >> > >> > On the other hand, being reminded that ^ does not do fractional exponents >> > is very important. >> >> is it important because there is no root operator or because scale >> itself is a side effect in other currently present operators? >> >> if it's the first, what about a patch that checks (scale && >> fractional_part != 0) before issuing the warning? > > Like teh diff below.
that's certainly better than the current situation; much appreciated > > BTW I was looking into the case 0.1^-1. Single Unix is pretty > confusing about it, talking about an absolute value being negaitive. > > To quote: > > expression^expression > > The result shall be the first expression raised to the power of the > second expression. If the second expression is not an integer, the > behavior is undefined. If a is the scale of the left expression and b > is the absolute value of the right expression, the scale of the result > shall be: > if b >= 0 min(a * b, max(scale, a)) if b < 0 scale i've read the posix 08 section on bc and decided that it's poorly written. to figure out how to lex bc you need to troll for the phrase "... is a delimiter" instead of getting a list straight up as is the case with the specification of shell. it also does not say what happens when there's an EOF in comments or strings i believe the sanest thing to do is to make ^ behave as closest to / when applicable, since that is what an user expects, but respect the scale of the result as specified by posix
