Oz and Mozart Hackers Mailing List

Re: trunc, trunc, wherefore art thou trunc


From: Christian Schulte (schulte@imit.kth.se)
Date: Mon Dec 02 2002 - 10:19:52 CET


Try floor or ceil as they are standard C/C++ and in math.h/math.

Regrads
Christian

"Kevin Glynn" <glynn@info.ucl.ac.be> wrote in message
news:<15851.7836.467597.622493@s-ensor.info.ucl.ac.be>...
>
>
> The recent check for the times/sysconf(_SC_CLK_TCK) bug fails on
> solaris, see below. Anyone know off hand where trunc comes from on
> solaris?
>
> thanks
> k
>
>
>
> @galley:sol-build 4Q> cat > kk.c
> #include <stdio.h>
> #include <unistd.h>
> #include <sys/times.h>
> #include <sys/time.h>
> extern double trunc(double);
>
> int main()
> {
> int clktck;
> struct tms buf;
> struct timeval tmv_begin;
> struct timeval tmv_end;
> clock_t tck_begin;
> clock_t tck_end;
> long int elapsed1;
> long int elapsed2;
> long int diff;
> double ratio;
> int fix;
>
> clktck = sysconf(_SC_CLK_TCK);
> (void) gettimeofday(&tmv_begin,NULL);
> tck_begin = times(&buf);
> usleep(1000000);
> (void) gettimeofday(&tmv_end,NULL);
> tck_end = times(&buf);
>
> elapsed1 = (tmv_end.tv_sec-tmv_begin.tv_sec)*1000 +
> (tmv_end.tv_usec-tmv_end.tv_usec)/1000;
> elapsed2 = ((tck_end-tck_begin)*1000)/clktck;
>
> ratio = ((double)elapsed2) / ((double)elapsed1);
> if (ratio < 1.0) fix=0;
> else fix = (int) trunc(ratio);
> printf("%d\n",fix);
> return 0;
> }
> @galley:sol-build 4Q> gcc -o kk kk.c -lm
> Undefined first referenced
> symbol in file
> trunc /var/tmp/ccEJaEbo.o
> ld: fatal: Symbol referencing errors. No output written to kk
> collect2: ld returned 1 exit status
> -
> Please send submissions to hackers@mozart-oz.org
> and administriva mail to hackers-request@mozart-oz.org.
> The Mozart Oz web site is at http://www.mozart-oz.org/.

-
Please send submissions to hackers@mozart-oz.org
and administriva mail to hackers-request@mozart-oz.org.
The Mozart Oz web site is at http://www.mozart-oz.org/.



This archive was generated by hypermail 2b29.