Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integer to double check fails when return object contains run time #71

Open
helske opened this issue Nov 25, 2021 · 2 comments
Open

Integer to double check fails when return object contains run time #71

helske opened this issue Nov 25, 2021 · 2 comments

Comments

@helske
Copy link
Contributor

helske commented Nov 25, 2021

Currently, the check where the integer is replaced with double can fail if the result contains information about the run time. I thought about fixing this by first repeating the original call, then comparing whether the double version differs more from the original call than its duplicate (in terms of length of setdiff), i.e.

no_change <- length (setdiff (out1, out2)) == length (setdiff (out1, outb))

But I then I noticed this line:

Sys.sleep (0.5) # in case Sys.time is used

So now I wonder if this fails in purpose or is that related to something else?

@mpadge
Copy link
Member

mpadge commented Aug 17, 2022

@helske Sorry it's taken so long to get back to these issues. Is this one still important? You're proposing to replace this line:

no_change <- length (setdiff (out1, out2)) == 0

... but i'm unsure what you intend outb to be in your above suggestion. At that point there are only the two objects for comparison, out1 and out2.

More generally, any information about run time should generally be some kind of time-specific object, and so should not trigger these integer tests, unless I'm misunderstanding?

@helske
Copy link
Contributor Author

helske commented Aug 18, 2022

If I remember correctly, the issue with the current version was that if out1 and out2 are for example lists with one list element containing the runtime such as output from system.time, then no_change will be FALSE. In my not very elegant suggestion outb is a repeat of the original call, so the idea was to test whether two repeated calls with integers differ less than the call with double conversion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants