Skip to main content

Questions tagged [floating-point]

2 votes
1 answer
250 views

Consider: heightScaled=$(bc <<< $H*$S/1) echo $heightScaled 45.0 Why am I getting 45.0 despite the same operations yielding 45 if used outside the script either interactively or piped into ...
VoQZ's user avatar
  • 29
0 votes
0 answers
35 views

I have a large table of numbers using the wrong decimal separator for my locale (dot instead of comma), so LibreOffice Calc does not parse them as numbers, but as strings. I can apply this function to ...
matj1's user avatar
  • 141
7 votes
3 answers
447 views

Bash printf floating number formatting (with %f or %g) is suddenly completely wrong, and changing all the time. An example output: $ export LC_ALL=C $ printf '%g\n' 1 1.20739e+3531 $ printf '%g\n' 1 4....
PlasmaBinturong's user avatar
1 vote
1 answer
81 views

I am trying to cross compile a go project (syzkaller) to target a Pi Zero so it can emulate usb devices. The problem is that I have been unable to find information regarding how to specify the proper ...
Darrion Ramos's user avatar
0 votes
0 answers
60 views

I tried printf "%.3f\n" 2.555500000000000104805053 printf "%.3f\n" 2.555500000000000104805054 the result was 2.555 2.556 same with printf "%.3f\n" 3....
R 9000's user avatar
  • 167
1 vote
1 answer
346 views

Here is some simple test code. #!bin/bash cpm=(0 1 0.094) lv=1 attack=5 defense=9 stamina=16 echo $((cpm[lv])) mycpm=$((cpm[lv])) #mycpm=`echo "0.094" | bc -l` cq=`echo "$attack*$...
Tim50001's user avatar
2 votes
3 answers
2k views

I'm needing to write a script on some embedded Linux systems that don't have bc installed on them and won't be able to have it installed. The script I'm writing is essentially a monitoring script that ...
William's user avatar
  • 43
0 votes
3 answers
3k views

I'm trying to write a script that detects the Linux OS and version and through the use of conditions and operators execute different commands depending on the result. Detect OS if [ -f /etc/os-release ...
willowen100's user avatar
1 vote
1 answer
2k views

I am trying to automate software update with bash script. When I am passing version number e.g 7.16.3 I get following error: ") Syntax error Invalid arithmetic operator (error token is " I ...
codehunter-py's user avatar
0 votes
1 answer
114 views

I am assigning a decimal value to a variable which is an output from an oracle command. when I echo the variable I see the decimal value. For example, echo $a is showing me .7214 but when I do ...
RAJ's user avatar
  • 1
0 votes
4 answers
642 views

I am comparing the floating point values in shell script based on this reference. Following is the script contents num1=50.960 num2=6.65E+07 echo "${num1} < ${num2}" | bc When I ran the ...
Raja's user avatar
  • 133
0 votes
2 answers
931 views

I have a double printed as text. Is there a way to pass that source text number to some utility in order to get the actual numeral i.e. the nearest actual representable double value? Either in decimal/...
Jim's user avatar
  • 1,499
0 votes
1 answer
386 views

Right now I am working on an assignment that involves advanced piping, and one of the questions involves calculating a percent and shortening it to 3 decimal places. I've managed to calculate the ...
PCRevolt's user avatar
2 votes
1 answer
409 views

working with a legacy system, here I'm connecting with sqlplus to store the returned value in a variable and its worked fine with me but the problem with compearing with floating values a numeric/...
yong shi's user avatar
1 vote
2 answers
524 views

How many decimal places will rand() give? I assume rand() value can't be any completely arbitrary number from 0 up to excluding 1 and that it's limited to a certain amount of decimal places or ...
Margo Oka's user avatar
  • 341

15 30 50 per page
1
2 3 4 5
7