Sponsored Content
Top Forums Shell Programming and Scripting Convert floating point to a number Post 303004175 by skatpally on Wednesday 27th of September 2017 03:21:33 PM
Old 09-27-2017
Convert floating point to a number

Hello Guys,
I have a floating point number 1.14475E+15 I want to convert this number in to full number (Integer or Big integer). I tried couple of functions it did not work. When I use INT=${FLOAT/.*} I am getting value as 1. I don't want a truncated value

Code:
#!/bin/bash
# Welcome to the Interactive Shell Tutorial.
# Start by choosing a chapter and
# write your code in this window.
FLOAT=1.14475E+15
#INT=${FLOAT/.*}
#INT=${FLOAT/\.*}
S[i] = INT(1.14475E+15)
echo $S[i]

Thanks

Last edited by RudiC; 09-27-2017 at 05:38 PM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

floating point addition

hi, :) I have a file like this 10.456 123.567 456.876 234.987 ........ ....... What i want to do is ia have to add all those numbers and put the result in some other file. Any help pls. cheers RRK (8 Replies)
Discussion started by: ravi raj kumar
8 Replies

2. Programming

floating point problem

Hi all! Hi all! I am working with a problem to find the smallest floating point number that can be represented. I am going in a loop ,stating with an initial value of 1.0 and then diving it by 10 each time thru the loop. So the first time I am getting o.1 which I wanted.But from the next... (4 Replies)
Discussion started by: vijlak
4 Replies

3. Programming

Floating point error in C

Hi, see the simple code below double i; i=8080.9940; printf(" val :%.30f\n",i); output i m getting is val :8080.993999999999700000000000000 when i m expecting val :8080.9940 what happens?how can i avoid it? thanks... (2 Replies)
Discussion started by: Hara
2 Replies

4. Linux

Floating point exception !!!

Hi, I have linux fedora 4 ver., 2.6 kernal. And qmail & mysql & samba servers are already configured on this server. When I try to install any package like squidguard ,dansguardian,webmin,rsnapshots with command rpm -ivh . It is giving error as “Floating point exception" Snap View is... (3 Replies)
Discussion started by: ssk01
3 Replies

5. Shell Programming and Scripting

using bc with floating point number in files

Hi, I' using bash and I would like to use "bc" to compute the ratio of of two numbers and assign the ratio to a variable. The numbers are in a file, e.g. 196.304492 615.348986 Any idea how to do it? N.B. I cannot change the file to have 196.304492 / 615.348986 as the file is produced by... (14 Replies)
Discussion started by: f_o_555
14 Replies

6. Shell Programming and Scripting

floating point number problem

Hello folks I Hope everyone is fine. I am calculating number of bytes calculation from apache web log. awk '{ sum += $10 } END { print sum }' /var/httpd/log/mydomain.log 7.45557e+09 it show above number, what should i do it sow number like 7455, i mean if after decimal point above 5 it... (5 Replies)
Discussion started by: learnbash
5 Replies

7. Shell Programming and Scripting

problem with floating point number loops

Hey, I guess I am just to stupid and am not seeing the "wood for the trees", but I am always getting strange errors. I want to create a mesh with coordinates like: x y z 3.1 3.0 0.75 0 0 1 3.1 2.9 0.75 0 0 1 3.1 2.8 0.75 0 0 1 3.1 2.7 0.75 0 0 1 3.0 ... (10 Replies)
Discussion started by: ergy1983
10 Replies

8. Programming

Floating Point

Anyone help me i cant found the error of floating point if needed, i added the code complete #include <stdio.h> #include <string.h> #include <stdlib.h> #include <ctype.h> typedef struct { int hh; int mm; int ss; char nom; int punt; }cancion; typedef struct... (9 Replies)
Discussion started by: Slasho
9 Replies

9. Shell Programming and Scripting

[BASH] Regex for floating point number

Hey again, I have a basic regex that tests if a number is a float. Thank you. (5 Replies)
Discussion started by: whyte_rhyno
5 Replies

10. Shell Programming and Scripting

Bash script to print the smallest floating point number in a row that is not 0

Hello, I have often found bash to be difficult when it comes to floating point numbers. I have data with rows of tab delimited floating point numbers. I need to find the smallest number in each row that is not 0.0. Numbers can be negative and they do not come in any particular order for a given... (9 Replies)
Discussion started by: LMHmedchem
9 Replies
Math::Polygon::Transform(3pm)				User Contributed Perl Documentation			     Math::Polygon::Transform(3pm)

NAME
Math::Polygon::Transform - Polygon transformation INHERITANCE
Math::Polygon::Transform is a Exporter SYNOPSIS
my @poly = ( [1,2], [2,4], [5,7], [1, 2] ); my $area = polygon_transform resize => 3.14, @poly; DESCRIPTION
This package contains polygon transformation algorithms. FUNCTIONS
polygon_grid(OPTIONS, LIST-OF-POINTS) Snap the polygon points to grid points, where artifacts are removed. -Option--Default raster 1.0 raster => FLOAT The raster size, which determines the points to round to. The origin "[0,0]" is always on a grid-point. When the raster value is zero, no transformation will take place. polygon_mirror(OPTIONS, LIST-OF-POINTS) Mirror the polygon in a line. Only one of the options can be provided. Some programs call this "flip" or "flop". -Option--Default b 0 line <undef> rc undef x undef y undef b => FLOAT Only used in combination with option "rc" to describe a line. line => [POINT, POINT] Alternative way to specify the mirror line. The "rc" and "b" are computed from the two points of the line. rc => FLOAT Description of the line which is used to mirror in. The line is "y= rc*x+b". The "rc" equals "-dy/dx", the firing angle. If "undef" is explicitly specified then "b" is used as constant x: it's a vertical mirror. x => FLOAT Mirror in the line "x=value", which means that "y" stays unchanged. y => FLOAT Mirror in the line "y=value", which means that "x" stays unchanged. polygon_move(OPTIONS, LIST-OF-POINTS) Returns a list of points which are moved over the indicated distance -Option--Default dx 0 dy 0 dx => FLOAT Displacement in the horizontal direction. dy => FLOAT Displacement in the vertical direction. polygon_resize(OPTIONS, LIST-OF-POINTS) -Option--Default center [0,0] scale 1.0 xscale <scale> yscale <scale> center => POINT scale => FLOAT Resize the polygon with the indicated factor. When the factor is larger than 1, the resulting polygon with grow, when small it will be reduced in size. The scale will be respective from the center. xscale => FLOAT Specific scaling factor in the horizontal direction. yscale => FLOAT Specific scaling factor in the vertical direction. polygon_rotate(OPTIONS, LIST-OF-POINTS) -Option --Default center [0,0] degrees 0 radians 0 center => POINT degrees => FLOAT specify rotation angle in degrees (between -180 and 360). radians => FLOAT specify rotation angle in rads (between -pi and 2*pi) polygon_simplify(OPTIONS, LIST-OF-POINTS) -Option --Default max_points undef same 0.0001 slope undef max_points => INTEGER First, "same" and "slope" reduce the number of points. Then, if there are still more than the specified number of points left, the points with the widest angles will be removed until the specified maximum number is reached. same => FLOAT The distance between two points to be considered "the same" point. The value is used as radius of the circle. slope => FLOAT With three points X(n),X(n+1),X(n+2), the point X(n+1) will be removed if the length of the path over all three points is less than "slope" longer than the direct path between X(n) and X(n+2). The slope will not be removed around the starting point of the polygon. Removing points will change the area of the polygon. DIAGNOSTICS
Error: you need to specify 'x', 'y', 'rc', or 'line' SEE ALSO
This module is part of Math-Polygon distribution version 1.02, built on September 19, 2011. Website: http://perl.overmeer.net/geo/ LICENSE
Copyrights 2004,2006-2011 by Mark Overmeer. For other contributors see ChangeLog. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See http://www.perl.com/perl/misc/Artistic.html perl v5.12.4 2011-09-19 Math::Polygon::Transform(3pm)
All times are GMT -4. The time now is 12:38 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy