Sponsored Content
Top Forums Shell Programming and Scripting Bash Decimal Addition using bc Post 302478354 by vb615 on Tuesday 7th of December 2010 06:25:46 PM
Old 12-07-2010
awesome that works. Thanks
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to sort decimal values in bash

Hi, I have a list of values from associative array from 0,..till 1.0000. I tried various sort options; sort -g, sort -nr but it still couldnt work. In other words, the numbers are not sorted accordingly. Please help. Thanks. (1 Reply)
Discussion started by: ahjiefreak
1 Replies

2. Shell Programming and Scripting

having a bash script convert ft to meters with 1 decimal

What is the correct syntax to limit the number of decimals to 1 or 0 in a bash script? Here is the partial code I have which works, but if I echo $meters, it has 4 or 5 decimals: METERS=`echo "$FEET * 0.3048" | bc` I read about scale and length in the bc man page, but I can't seem to get the... (2 Replies)
Discussion started by: audiophile
2 Replies

3. Shell Programming and Scripting

[bash]printf octal instead of decimal

Hello everybody, I would like to understand why the printf function is returning me an octal value with this command : printf %4.4d 0010 returns 0008 printf %4.4d 10 returns 0010 Thanks for help. (3 Replies)
Discussion started by: dolphin06
3 Replies

4. Shell Programming and Scripting

incremental addition of hex decimal number in one field

Hi I want to incremental add hex decimal number to a particula field in file eg: addr =123 dept1=0 addr = 345 dept2 =1 addr2 = 124 dept3 =2 . . . . . . addr3 =567 dept15 =f Is there any command which add... (8 Replies)
Discussion started by: diddi_linux
8 Replies

5. Shell Programming and Scripting

addition of decimal no

a=10.00 pattern=-11.00 b=`echo "$a $pattern" | awk ' printf("%d\n", $1 + $2)'` echo $b not working, also trined bc ,dc but thats not on my m/c. also expr not supporting. any clue? (6 Replies)
Discussion started by: saluja.deepak
6 Replies

6. Shell Programming and Scripting

bin bash decimal compare

I need decimal comparing with if. Check if apache version is less than 2.2.17. I tried this and not working. #!/bin/bash apachever=`/usr/local/apache/bin/httpd -v | head -1 | awk '{print $3}' |cut -d/ -f 2` if ]; then echo "Apache version less than 2.2.17" else ... (7 Replies)
Discussion started by: anil510
7 Replies

7. Shell Programming and Scripting

Addition to Bash shell script that emails final output as attachement?

Greetings. I have a nice bash shell script that runs a multi-step analysis well. I already have the SGE options set up to email me the progress of the run (started, completed, aborted), but a final step would be to code the shell script to email the final output (a .txt file) to the same email... (6 Replies)
Discussion started by: Twinklefingers
6 Replies

8. Shell Programming and Scripting

Bash Rounding to 2 decimal places

I have a number in a bash variable n, and want to round it to 2 decimal places. How can I do that? n=0.0867268 Need to have num=0.09 (1 Reply)
Discussion started by: kristinu
1 Replies

9. Shell Programming and Scripting

How to compare decimal values in bash?

Hi, I am facing some error while doing the comparision between 2 decimal values in bash. Pl help me out. I have tried using below scripts. But its giving me error. 1)amt=12.3 opn_amt=12.5 var=$(awk 'BEGIN{ print "'$amt'"<"'$opn_amt'" }') if ;then echo "correct" else echo "Wrong"... (3 Replies)
Discussion started by: Siba Tripathy
3 Replies

10. UNIX for Beginners Questions & Answers

Read a file with decimal numbers in bash

Hello, I have the following script while read id fraction do sambamba -h -f bam -t 10 --subsampling-seed=50 -s $frac ${id}.bam -o ${id}.out.bam done < fraction.txt where fraction.txt has two columns (id,fraction) and 50 rows I am unable to run this as bash is not able to read the second... (2 Replies)
Discussion started by: nans
2 Replies
MPSImageArithmetic(3)					 MetalPerformanceShaders.framework				     MPSImageArithmetic(3)

NAME
MPSImageArithmetic SYNOPSIS
#import <MPSImageMath.h> Inherits MPSBinaryImageKernel. Inherited by MPSImageAdd, MPSImageDivide, MPSImageMultiply, and MPSImageSubtract. Instance Methods (nonnull instancetype) - initWithDevice: Properties float primaryScale float secondaryScale float bias MTLSize primaryStrideInPixels MTLSize secondaryStrideInPixels float minimumValue float maximumValue Additional Inherited Members Detailed Description MPSImageMath.h MetalPerformanceShaders.framework Copyright: Copyright (c) 2016 Apple Inc. All rights reserved. MetalPerformanceShaders math filters This depends on Metal.framework. This filter takes two source images, a primary source image and a secondary source image, and outputs a single destination image. It applies an element-wise arithmetic operator to each pixel in a primary source image and a corresponding pixel in a secondary source image over a specified region. The supported arithmetic operators are the following: o Addition o Subtraction o Multiplication o Division This filter takes additional parameters: primaryScale, secondaryScale, and bias. The default value for primaryScale and secondaryScale is 1.0f. The default value for bias is 0.0f. This filter applies primaryScale, secondaryScale, and bias to the primary source pixel (x) and secondary source pixel (y) in the following way: o Addition: result = ((primaryScale * x) + (secondaryScale * y)) + bias o Subtraction: result = ((primaryScale * x) - (secondaryScale * y)) + bias o Multiplicaton: result = ((primaryScale * x) * (secondaryScale * y)) + bias o Division: result = ((primaryScale * x) / (secondaryScale * y)) + bias To clamp the result of an arithmetic operation, where result = clamp(result, minimumValue, maximumValue), set the minimumValue and maximumValue appropriately. The default value of minimumValue is -FLT_MAX. The default value of maximumValue is FLT_MAX. This filter also takes the following additional parameters: o primaryStrideInPixels o secondaryStrideInPixels These parameters can be used to control broadcasting for the data stored in the primary and secondary source images. For example, setting all strides for the primary source image to 0 will result in the primarySource image being treated as a scalar value. The only supported values are 0 or 1. The default value of these parameters is 1. This filter accepts uint and int data in addition to unorm and floating-point data. You must use one of the sub-classes of MPSImageArithmetic. Method Documentation - (nonnull instancetype) initWithDevice: (nonnull id< MTLDevice >) device Standard init with default properties per filter type Parameters: device The device that the filter will be used on. May not be NULL. Returns: a pointer to the newly initialized object. This will fail, returning nil if the device is not supported. Devices must be MTLFeatureSet_iOS_GPUFamily2_v1 or later. Reimplemented from MPSBinaryImageKernel. Reimplemented in MPSImageAdd, MPSImageSubtract, MPSImageMultiply, and MPSImageDivide. Property Documentation - (float) bias [read], [write], [nonatomic], [assign] - maximumValue [read], [write], [nonatomic], [assign] maximumValue is used to clamp the result of an arithmetic operation: result = clamp(result, minimumValue, maximumValue). The default value of maximumValue is FLT_MAX. - minimumValue [read], [write], [nonatomic], [assign] minimumValue is to clamp the result of an arithmetic operation: result = clamp(result, minimumValue, maximumValue). The default value of minimumValue is -FLT_MAX. - (float) primaryScale [read], [write], [nonatomic], [assign] - primaryStrideInPixels [read], [write], [nonatomic], [assign] The secondarySource stride in the x, y, and z dimensions. The only supported values are 0 or 1. The default value for each dimension is 1. - (float) secondaryScale [read], [write], [nonatomic], [assign] - secondaryStrideInPixels [read], [write], [nonatomic], [assign] The secondarySource stride in the x, y, and z dimensions. The only supported values are 0 or 1. The default value for each dimension is 1. Author Generated automatically by Doxygen for MetalPerformanceShaders.framework from the source code. Version MetalPerformanceShaders-100 Thu Feb 8 2018 MPSImageArithmetic(3)
All times are GMT -4. The time now is 01:41 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy