Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

2^(10000-2)

Status
Not open for further replies.

iribach

Technical User
Oct 12, 2002
211
CH


2^(10000-2)
i tried awk, perl, c
too big
can you help?
thanks
 
Have you tried this ?
echo "2^(10000-2)" | bc

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
yes i tried [bd]c
wonderful tools
but, they are interactive :(
 
but, they are interactive
???
i=$(echo "2^(10000-2)" | bc | awk '{a=a""substr($0,1,length($0)-1)}END{print a}')
echo "2^(10000-2) = $i"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
ok, maybe not clear
the job is
a) do this calculations in a not interactive prog
b) i cannot use popen(), neither system() nor shells
c) every formula can be passed, not just 2^(...)
d) i believe, [db]c as you suggested, is a good way,
but how convince them to work NOT interactvely
 
i cannot use popen(), neither system() nor shells
And what can you use ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
phv
change your login to: mr.awk
#this line is clear
i=$(echo "2^(10000-2)" | bc | awk
#now i get probls, can you tell more
'{a=a""substr($0,1,length($0)-1)}END{print a}')
echo "2^(10000-2) = $i
 
In my box, bc output long line like this:
123456...789987654...321So this little awk script to get rid of the \s and rebuild (concatenate) the loooong number.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
iribach,

My C is a bit rusty, but without popen(), system() or shells, how are you going to run an external process at all?



Rod Knowlton
IBM Certified Advanced Technical Expert pSeries and AIX 5L

 
I guess I don't udenrstand what the OP wanted to begin with.

What does that mean?:

do this calculations in a not interactive prog

If you're looking for 'C' solution, maybe this is NOT the right forum for your question.

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
Hi,
This sounds like a class assignment.

Isn't Asking for help on Home Work against the Policy of Tek Tips....

Just a thought.

----
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top