|
Agena v. 6.5.5 (22/12/2025, Alexander Walz) |
Readme/What's new |
agena >>
`The Power of Procedural Programming`
6.5.5 Catahoula, December 22, 2025
- `mpf.new` now accepts an MPFR floating-point number as input and just returns it.
- Likewise, `mp.uint` and `mp.sint` accept GMP integers as input and just return them.
- When given no argument, `long.eps` did not return the machine epsilon value but a mathematical epsilon value. This has been fixed.
- The new `unimath` (universal math) package provides functions that work with either ordinary Agena numbers, MAPM, MPFR or long 80-bit precision floating-point numbers.
You should have already initialised the `mapm` or `mpf` package if needed.
The functions are:
unimath.max(x, y)
Returns the maximum of x, y, which must be of the same type.
unimath.min(x, y)
Returns the minimum of x, y, which must be of the same type.
unimath.approx(x, y [, eps])
Checks whether two numbers are approximately equal taking the magnitude of the input into account.
The function works like `approx`. By default, eps is Eps. x and y must be of the same type.
unimath.zeroin(f, a, b [, eps])
Determines the root of the univariate function f over the interval [a, b].
The accuracy can be controlled by the optional argument eps, which defaults to Eps.
a, b and optionally eps must be of the same type.
The function works like `calc.zeroin`.
unimath.xpdiff(f, x [, deriv = <n>] [, eps=<value>] [, delta=<value>] )
Computes the n'th derivative of univariate function f at point x. n may be a value from 0 to 5, with 1 the default, for the first derivative. If deriv is zero, the function just returns f(x).
The function works like `calc.xpdiff`, check the Agena Reference for the `eps` and `delta` options
Examples:
> import mapm, mpf, unimath
> mapm.xdigits(40)
> mapm.Pi:
3.1415926535897932384626433832795028841972
> unimath.zeroin(<: x -> sin(x) :>, mapm.new(3), mapm.new(4)):
3.1415926535897932384626433832795028845877
> unimath.xpdiff(<: x -> sin(x) :>, mpf.new(1)):
mpf(.5403023058681269184051664841845724091374)
> cos(mpf.new(1)):
mpf(.5403023058681397174009366074429766037334) |
|
Agena v. 4.12.5 (20/5/2025, Alexander Walz) |
Readme/What's new |
4.12.5 Merryville, May 20, 2025
- In the past, the bitshift operators <<< (left shift), >>> (right shift), <<<< (left rotation) and >>>> (right rotation) had different behaviour across platforms when a number at or beyond the +/-2^32 threshold has been processed. This has been changed and the results in these situations are now the same.
Likewise, `bytes.numto32` is now returning the same results on all platforms when casting a value at or beyond the +/-2^32 border.
This also benefits various functions in the `hashes` package as their returns are now the same across platforms, as well.
To check the new underflow or overflow behaviour, use `math.wrap`.
- New function `math.fmod` works and returns the same result as the binary `symmod` operator. It has just been added to facilitate porting C code to Agena.
- The results of `hashes.mix`, `hashes.crc32`, `hashes.crc8`, `hashes.reflect`, `hashes.parity`, `hashes.fibmod`, `hashes.interweave`, `hashes.jinteger` may now be different with out-of-range input, that is with arguments at or beyond the 2^32 threshold, depending on your platform. |
Comments
Alexander Walz
Sat, 13/05/2017 - 20:06
Permalink
Hello,
Add new comment