About 4,240,000 results
Open links in new tab
  1. How do I use floating-point arithmetic in bash? - Stack Overflow

    If you need a full floating point library in bash, that you can easily import (source), use my code here: bash/floating_point_math.sh in my eRCaGuy_hello_world repo. See also my answer …

  2. Addition of two floating point numbers using shell script

    Apr 21, 2017 · Use this to add two floating numbers. Just replace the numbers with your variables. You may use. Using bc: #!/bin/bash. n="$@" . bc <<< "${n// /+}" Supposing the …

  3. How to Do Floating Point Math in Linux Bash Scripts - How-To Geek

    Linux comes with two utility applications that allow you to perform floating point calculations. One of these is dc. It’s a bit of a curio, operating as it does in reverse-Polish notation. The other tool …

  4. Shell Scripting: Floating-point numbers | by Samuel Kadima

    May 9, 2023 · In this article, we will explore the use of floating-point numbers in shell scripting, and how to perform arithmetic operations with them. We will also provide practical examples to...

  5. Floating Point Math Calculations in Bash – TecAdmin

    Apr 26, 2025 · In this article, we will explore different techniques to perform floating-point math calculations in Bash, along with practical examples. Table of Contents. Introduction to Floating …

  6. Floating Point Arithmetic in Bash - Delft Stack

    Feb 15, 2024 · Performing quick floating point calculations at the command prompt (shell) or in shell scripts may be helpful if you work with numbers. The following four methods to do floating …

  7. How to Do Floating Point Math in Linux Bash Scripts

    Dec 18, 2024 · To create a shell function for floating point math in Bash, you can use the following syntax: echo "scale=2; $1 + $2" | bc. This will output 5.85, which is the result of adding 3.14 …

  8. Bash Floating Point Addition - Examples - Tutorial Kart

    Bash Floating Point Addition. By default, Bash only supports integer arithmetic using constructs like $((...)). However, you can perform floating-point addition using external tools like bc (Basic …

  9. Floating-point arithmetic in UNIX shell script - Stack Overflow

    How to do arithmetic with floating point numbers such as 1.503923 in a shell script? The floating point numbers are pulled from a file as a string. The format of the file is as follows: 1.5493482,3.

  10. shell - How to do integer & float calculations, in bash or other ...

    Jun 14, 2013 · Using printf ability to print floats we can extend most shells to do floating point math albeit with a limited range (no more than 10 digits): $ printf %.10f\\n "$((1000000000 * …

Refresh