On Tuesday, December 6, 2016 at 7:07:33 PM UTC+1, Harry Stoteles wrote:
> Does your Prolog system do high fidelity float/1
> for big nums or not?
>
> Unfortunately the ISO core standard doesn't prescribe
> a particular rounding function in its current form.
It's rather unfortunate that the standard got bogged down into defining
arithmetic types, in fact into defining any types at all.
That said, in every floating-point system, including the ubiquitous IEEE 754,
there are several rounding modes, and a *correct* implementation SHOULD provide:
1) predicates that take a rounding mode as a parameter for full user control;
2) (optionally) predicates that default the rounding mode to the rounding
mode that is currently set at FPU level;
3) (optionally) predicates that default the rounding mode to banker's rounding.
While 3 could be the default and certainly is the most common option, note
that without 1 or at least 2 some algorithms/systems become simply impossible
to implement (correctly). (And, with 2 but without 1, they can be implemented
but at the prohibitive performance cost of out-of-band native calls.)
Julio