Sponsored Content
Operating Systems OS X (Apple) A Fun Perfect Square Checker Using Integer Arithmetic Only... ;o) Post 302952689 by Don Cragun on Thursday 20th of August 2015 11:13:08 PM
Old 08-21-2015
Quote:
Originally Posted by neutronscott
Don cheated!!
... ... ...
---------- Post updated at 10:58 PM ---------- Previous update was at 10:45 PM ----------

using a binary search was idea taken from friend.. they implemented in bash and I again convert to awk.

... ... ...
Let me get this straight... I use a different algorithm in a ksh script and get better times than using the original algorithm in a bash script, and I'm cheating...

But neutronscott uses a different algorithm in awk to get times similar to my ksh script and that's OK???

Sounds like a different standard of fairness to me. Smilie
 

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

extraction of perfect text from file.

Hi All, I have a file of the following format. <?xml version='1.0' encoding='utf-8'?> <tomcat-users> <role rolename="tomcat"/> <role rolename="role1"/> <role rolename="manager"/> <role rolename="admin"/> <user username="tomcat" password="tomcat" roles="tomcat"/> <user... (5 Replies)
Discussion started by: nua7
5 Replies

2. UNIX for Dummies Questions & Answers

A perfect number shell program

Here's my work of testing whether a number input is perfect or not.. echo Enter a number read no i=1 ans=0 while do if then ans='expr $ans + $i' fi i='expr $i + 1' done if then echo $no is perfect else echo $no is NOT perfect fi (12 Replies)
Discussion started by: Cyansnow
12 Replies

3. AIX

I want the perfect user-interface

I've got an aix-box somewhere on the network and a PC on my desk. Nothing fancy so far. The PC is made dual-boot: - windowsXP with putty & winSCP or - slackware 13 with xfce4 installed. The aix-box runs DB2 v8.2 and I've installed db2top to monitor the database. db2top is a character... (0 Replies)
Discussion started by: dr_te_z
0 Replies

4. Shell Programming and Scripting

Delete text between square brackets and also delete those square brackets using sed or awk

Hi All, I have a text file which looks like this: computer programming systems engineering I want to get rid of these square brackets and also the text that is inside these brackets. So that my final text file looks like this: computer programming systems engineering I am using... (3 Replies)
Discussion started by: shoaibjameel123
3 Replies

5. Shell Programming and Scripting

how to compare string integer with an integer?

hi, how to I do this? i="4.000" if ; then echo "smaller" fi how do I convert the "4.000" to 4? Thanks! (4 Replies)
Discussion started by: h0ujun
4 Replies

6. UNIX for Dummies Questions & Answers

Can you perfect my sed ?

I want to print only the lines that meet the criteria : "worde:" and "wordo;" I got this far: sed -n '/\(*\)\1e:\1o;/p;' But it doesn't quite work. Can someone please perfect it and tell me exactly how its a fixed version/what was wrong with mine? Thanks heaps, (1 Reply)
Discussion started by: maximus73
1 Replies

7. Shell Programming and Scripting

egrep line with perfect mach

Hi Input File A L006 AL01 0 (OCK) L006 A006 0 (OCK) L011 AR11 1 (NLOCK) Input File B L006 AL01 0 (OCK) L006 A006 0 (OCK) Need Egrep Command for perfect Match Thanks (4 Replies)
Discussion started by: asavaliya
4 Replies

8. Shell Programming and Scripting

Not able to find the perfect code...Geting confused in between

I have to find last delimiter in each line of a file and store the value after the last '/' in a variable in ksh script...Pls Pls help me:(The file is as shown below: /opt/apps/cobqa/apps/abadv/bind/advc0007.bnd /opt/apps/cobqa/apps/abbrio/bind/naac6115.bnd... (5 Replies)
Discussion started by: bhavanabahety
5 Replies
funimagerowput(3)						SAORD Documentation						 funimagerowput(3)

NAME
FunImageRowPut - put row(s) of an image SYNOPSIS
#include <funtools.h> void *FunImageRowPut(Fun fun, void *buf, int rstart, int rstop, int dim1, int dim2, int bitpix, char *plist) DESCRIPTION
The FunImageRowPut() routine writes one or more image rows to the specified FITS image file. The first argument is the Funtools handle returned by FunOpen(). The second buf argument is a pointer to the row data buffer, while the third and fourth arguments specify the starting and ending rows to write. Valid rows values range from 1 to dim2, i.e., row is one-valued. The dim1and dim2 arguments that follow specify the dimensions, where dim1 corresponds to naxis1 and dim2 corresponds to naxis2. The bitpix argument data type of the image and can have the following FITS-standard values: o 8 unsigned char o 16 short o 32 int o -32 float o -64 double For example: double *drow; Fun fun, fun2; ... open files ... /* get section dimensions */ FunInfoGet(fun, FUN_SECT_DIM1, &dim1, FUN_SECT_DIM2, &dim2, 0); /* allocate one line's worth */ drow = malloc(dim1*sizeof(double)); /* retrieve and process each input row (starting at 1) */ for(i=1; i <= dim2; i++){ if( !FunImageRowGet(fun, drow, i, i, "bitpix=-64") ) gerror(stderr, "can't FunImageRowGet: %d %s ", i, iname); ... process drow ... if( !FunImageRowPut(fun2, drow, i, i, 64, NULL) ) gerror(stderr, "can't FunImageRowPut: %d %s ", i, oname); } ... The data are assumed to be in the native machine format and will automatically be swapped to big-endian FITS format if necessary. This behavior can be over-ridden with the convert=[true|false] keyword in the plist param list string. When you are finished writing the image, you should call FunFlush() to write out the FITS image padding. However, this is not necessary if you subsequently call FunClose() without doing any other I/O to the FITS file. SEE ALSO
See funtools(7) for a list of Funtools help pages version 1.4.2 January 2, 2008 funimagerowput(3)
All times are GMT -4. The time now is 05:10 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy