scryer-prolog icon indicating copy to clipboard operation
scryer-prolog copied to clipboard

WIP: Add float_integer_part/1 and float_fractional_part/1 standard arithmetic functions

Open pmoura opened this issue 3 years ago • 1 comments

Started adding support for the float_integer_part/1 and float_fractional_part/1 standard arithmetic functions. But need help from more Rust-savvy developers to complete the implementation. Notably, how to import Trait num::Float.

pmoura avatar Sep 27 '21 11:09 pmoura

i think you meant n1.fract() and n1.trunc() instead of self.fract(n1) and self.trunc(n1).

however, i'm new to this project, so i may be wrong

pro465 avatar Oct 24 '21 02:10 pro465

I pushed a branch of the same name to github which updates the branch to the current master. Two tests don't pass but it otherwise appears to work.

mthom avatar Jul 21 '23 21:07 mthom

The two tests that fail are for missing type error when the argument is an integer instead of a float. Same issue that's causing the remaining test failures for evaluable functors listed in https://github.com/mthom/scryer-prolog/issues/1898#issuecomment-1644671535. In the ISO Prolog Core standard, there isn't an evaluable functor signature for an integer argument. It should be noted that several systems happily accept an integer argument (including some often cited for their good compliance). If you consider mixed arithmetic something to avoid, the type error makes sense. If not, the type error is a nuisance.

pmoura avatar Jul 21 '23 22:07 pmoura

Sorry @pmoura , I didn't mean to delete your last comment. There doesn't seem to be a way to undo it. In any event, I'll merge my own version of this PR later today.

mthom avatar Jul 22 '23 19:07 mthom

No worries. I did the merge you request, updating this pull request. But it may be cleaner (as far as git history goes to merge your own version. As you prefer.

pmoura avatar Jul 22 '23 19:07 pmoura