scryer-prolog
scryer-prolog copied to clipboard
WIP: Add float_integer_part/1 and float_fractional_part/1 standard arithmetic functions
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
.
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
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.
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.
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.
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.