Sponsored Content
Top Forums Shell Programming and Scripting Q: Is SQRT(n) possible in a POSIX compliant shell? A: Yes within limits. Post 303039674 by wisecracker on Friday 11th of October 2019 12:45:21 PM
Old 10-11-2019
Quote:
Originally Posted by jim mcnamara
Paul Hsieh's square root page has a bunch of square root algorithms including using Newton's method:

Paul Hsieh's Square Root page

I used to play with these, lots o' fun.
Neat, not an integer shell version though. It would be interesting if someone else has actually done it...
Working on Nth root at the moment, but I suspect it will be a step too far for a POSIX shell.

@Neo...

The dark green looks good...

Moderator's Comments:
Mod Comment Discussion on new forum tag and color changes moved here.
 

10 More Discussions You Might Find Interesting

1. Programming

sqrt

Hi! when i'm trying to compile this lite example on my linux machine I'll get errors and i don't know why.. #include <stdio.h> #include <math.h> /* needed by sqrt() */ int main() { printf("%f", sqrt(10.0)); return (0); } this is the error: /tmp/cc33hNVHK.o: In function... (1 Reply)
Discussion started by: CreamHarry
1 Replies

2. Programming

Is gcc compliant with the C++ standards

Hello Friends, I am a newbie and have started using different compilers and tools to make myself familiar with their workings. I wanted to know that how compliant is gcc with the C++ standards. It is pretty obvious that no compiler is close to being completely compliant, but if there are some... (7 Replies)
Discussion started by: hthapar
7 Replies

3. UNIX for Dummies Questions & Answers

sqrt in bash

Hi, i have a the following script: #!/bin/bash a=3 b=9 let "c= b*a" let "d=sqrt $c " echo $d But when i execute the code, it gives me the an error saying: line 5: let: d=sqrt 27 : syntax error in expression (error token is "27 ") Can any body tell me what I'm doing wrong? (5 Replies)
Discussion started by: limadario
5 Replies

4. Shell Programming and Scripting

Logical expression in POSIX compliant Korn Shell

Hi, i want to check if a variable var1 is not a or b or c pseudo code: If NOT (var1 = a or var1 = b or var1 = c) then ... fi I want to use POSIX complaint Korn shell, and for string comparison For the following code, logical.sh #!/usr/bin/ksh var="j" echo "Var : $var" if ! { || ||... (12 Replies)
Discussion started by: ysrini
12 Replies

5. UNIX for Dummies Questions & Answers

Soft and hard limits for nproc value in /etc/security/limits.conf file (Linux )

OS version : RHEL 6.5 Below is an excerpt from /etc/security/limits.conf file for OS User named appusr in our server appusr soft nproc 2047 appusr hard nproc 16384 What will happen if appusr has already spawned 2047 processes and wants to spawn 2048th process ? I just want to know... (3 Replies)
Discussion started by: kraljic
3 Replies

6. Shell Programming and Scripting

Is Rule 7 of POSIX shell grammar rules written correctly?

The POSIX shell standard grammar rules are at Shell Command Language I am trying to understand Rule 7 and I don't. I think there may be some mistakes there. I am not complaining about the standard; rather, I am concerned that my perception is wrong, and I don't understand something important.... (3 Replies)
Discussion started by: Mark_Galeck
3 Replies

7. Shell Programming and Scripting

Pure POSIX shell scripting...

Hi all... This is more of a concensus question than help... As many of you know I am experimenting with the limitations of Pure POSIX shell scripting. Q: Is the directory /bin considered part of the Pure POSIX shell or must I stick entirely with the builtins only? The reason is I... (2 Replies)
Discussion started by: wisecracker
2 Replies

8. What is on Your Mind?

Popularity-Boost for the POSIX-Shell in the Era of Containerized Computing?

Not even thinking that POSIX-Shell is deprecated, but I like working with bash very much, because of it's increased comfort and advanced functions. And in my world here it's available everywhere as default. Working with kubernetes now, it seems there is a paradigm shift in terms of resources.... (1 Reply)
Discussion started by: stomp
1 Replies

9. Shell Programming and Scripting

Equivalent to let command in POSIX shell

Hi all, I am learning POSIX shell programming, and the book I read, uses the let command for integer arithmetic. I have downloaded and use the shellcheck program on Linux. This programs says: In POSIX sh, 'let' is undefined. See the screenshot attached. What is the POSIX... (1 Reply)
Discussion started by: johnprogrammer
1 Replies

10. OS X (Apple)

Generate a random number in a fully POSIX compliant shell, 'dash'...

Hi all... Apologies for any typos, etc... This took a while but it didn't beat me... Although there are many methods of generating random numbers in a POSIX shell this uses integer maths and a simple C source to create an executable to get epoch to microseconds accuracy if it is needed. I take... (8 Replies)
Discussion started by: wisecracker
8 Replies
platform::shell(n)					       Tcl Bundled Packages						platform::shell(n)

__________________________________________________________________________________________________________________________________________________

NAME
platform::shell - System identification support code and utilities SYNOPSIS
package require platform::shell ?1.1.4? platform::shell::generic shell platform::shell::identify shell platform::shell::platform shell _________________________________________________________________ DESCRIPTION
The platform::shell package provides several utility commands useful for the identification of the architecture of a specific Tcl shell. This package allows the identification of the architecture of a specific Tcl shell different from the shell running the package. The only requirement is that the other shell (identified by its path), is actually executable on the current machine. While for most platform this means that the architecture of the interrogated shell is identical to the architecture of the running shell this is not generally true. A counter example are all platforms which have 32 and 64 bit variants and where a 64bit system is able to run 32bit code. For these running and interrogated shell may have different 32/64 bit settings and thus different identifiers. For applications like a code repository it is important to identify the architecture of the shell which will actually run the installed packages, versus the architecture of the shell running the repository software. COMMANDS
platform::shell::identify shell This command does the same identification as platform::identify, for the specified Tcl shell, in contrast to the running shell. platform::shell::generic shell This command does the same identification as platform::generic, for the specified Tcl shell, in contrast to the running shell. platform::shell::platform shell This command returns the contents of tcl_platform(platform) for the specified Tcl shell. KEYWORDS
operating system, cpu architecture, platform, architecture platform::shell 1.1.4 platform::shell(n)
All times are GMT -4. The time now is 07:04 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy