Herbie plugins define new functions, add rewrite rules, and even implement number representations.
Herbie plugins are installed separately. Herbie then automatically loads and uses them.
The softposit-herbie plugin implements support for posit arithmetic. Install it with:
raco pkg install --auto softposit-herbie
This plugin uses the SoftPosit library, only supported on Linux.
Even then is reported to misbehave on some machines. The plugin
support arithmetic operations,
sqrt, and quires.
Once softposit-herbie is installed,
:precision posit16 to inform Herbie that it
should assume the core's inputs and outputs are posit numbers. Other
posit sizes (with 8 or 32 bits) and also quires (for 8, 16, and 32
bit posits) are available, but are poorly supported.
The complex-herbie plugin implements support for complex numbers. Install it with:
raco pkg install --auto complex-herbie
Herbie input parameters are always real numbers; complex
numbers must be constructed with
are available on complex numbers, along with the arithmetic
sqrt. Complex and real operations use the same
syntax, but cannot be mixed:
(+ (complex 1 2) 1) is not
valid. Herbie reports type errors in such situations.
Complex operations are implemented by Racket, so results may differ (slightly) from complex numbers in some other language, especially for non-finite complex numbers. In the future, we hope to support complex-number arguments and fully support all complex-number operations.
The plugin functionality is currently highly experimental; if you would like to develop your own plugins, please write to the mailing list.