Bug 5020 - implementation of myceil in pbs.pm
: implementation of myceil in pbs.pm
Status: RESOLVED FIXED
: GRAM
wsrf scheduler interface
: 4.0.3
: PC All
: P3 trivial
: 4.0.6
Assigned To:
:
:
:
:
  Show dependency treegraph
 
Reported: 2007-02-21 03:36 by
Modified: 2007-08-07 11:24 (History)


Attachments


Note

You need to log in before you can comment on or make changes to this bug.


Description From 2007-02-21 03:36:14
1. myceil should always return an integer:
 sub myceil ($)
 {
     my $x = shift;
-    ( abs($x-int($x)) < 1E-12 ) ? $x : int($x < 0 ? $x : $x+1.0);
+    ( abs($x-int($x)) < 1E-12 ) ? int($x) : int($x < 0 ? $x : $x+1.0);
 }

2. Should we use POSIX::ceil instead?
------- Comment #1 From 2007-02-23 16:17:22 -------
Is this a problem you've actually encountered? Not using POSIX::ceil was a
micro-optimization to avoid disk accesses when running the job script.
------- Comment #2 From 2007-02-26 12:18:40 -------
(In reply to comment #1)
> Is this a problem you've actually encountered? Not using POSIX::ceil was a
> micro-optimization to avoid disk accesses when running the job script.

The only Problem I had, was to understand, what this strange function myceil
actually does. No doubt, a ceil function which sometimes produces a non-int
(according to the written code) is strange.

I am not sure, if my first suggestion is a really good clarification. Regarding
the only call to myceil in pbs.pm it meight be much better to user sprintf.

Using POSIX or not: To avoid confusion of code readers like me, there should be
a comment with the specific explanation you gave above.