Skip to content
Permalink
Browse files

added sci-num.sh to convert -ve scientific notation to a float using …

…bash
  • Loading branch information...
EvilRedHorse
EvilRedHorse committed May 30, 2019
1 parent a6fd3b6 commit f557d239e52a158464b6929fa56f3cb4b126ce95
Showing with 10 additions and 0 deletions.
  1. +10 −0 sci-num.sh
@@ -0,0 +1,10 @@
#! /usr/bin/sh
# Attention: only works for negative exponents
# Title: scientific notation to float
# Author: Stefan Crawford
# Requires: bc
# set to exit on error
set -o errexit
# take in scientific notation
read SCI
echo "scale=${#SCI}+${SCI##*e-}; ${SCI%e*}"^"${SCI##*e}" | bc

0 comments on commit f557d23

Please sign in to comment.
You can’t perform that action at this time.