Floating point numbers have a complex representation using base 2 rather than base 10. Scientific notation is close enough to understand what is happening. With scientific notation, we want a number between 1 and 10 multiplied by a power of 10: 8080.9940 = 8.0809940 * 10^3 and we can check that out with bc:
But now we need to do that in binary... We want a number between 1 and 10 in binary (which means 1 and 2 in decimal) that can be multiplied by a power of 10 in binary to yield the decimal number 8080.9940. Fortunately, you picked an easy number! It's is obvious that dividing it by 4096 will yield a number between 1 and 2. So let's use bc to do this...
Now repeat the last operation, but replace 1.11111001000011111110011101101100100 with some other close-by binary number. No matter what you try, you cannot get exactly 8080.9940 Floating point numbers are bit more complex than this, but the exact same issue arises with them. There is no way to exactly represent 8080.9940 as a floating point number.
Does anyone have a simple way of doing floating point ("fp") division? For example, if I divide 3 by 5, I can get 0.6. The built-in calc (`bc`) will perform fp multiplication, but not division, at least not straight-up (i.e., starting bc and just typing in 3/5).
I am trying to do this using... (1 Reply)
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)
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)
Hi,
I am compiling "HelloWorld" C progam on 32-bit CentOS and i want to execute it on 64-bit CentOS architecture.
For that i copied the a.out file from 32-bit to 64-bit machine, but while executing a.out file on 64bit machine I am getting "Floating point exception error".
But we can run... (3 Replies)
Here's a program and its pretty simple .It requires file handling and some calculations but on running it I am not getting the required result.It seems that the code outside the file read's outer while loop is not executing e.g the print statement is not being printed.Plz Help!
#include<stdio.h>... (1 Reply)
Hi,
Could any one tell me how to compare to floating point no. using test command. As -eq option works on only intergers.
i=5.4
if
then
echo "equal"
else
echo "not equal"
fi
here output will be equal even though no. are unequal.
Thanks,
ravi (1 Reply)
is it not possible to simply di aritmetic without using bc or awk
i have tried folllowing operatrions but they support only integer types plz suggest me code for floating using values stored in the variables.the ans i get is integer and if i input floating values i get error numeric constant... (6 Replies)
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)
I am writing a script in zsh shell, it fetchs a number from a file using the awk command, store it as a variable, which in my case is a small number 0.62000. I want to change this number by multiplying it by 1000 to become 620.0 using the command in the script
var2=$((var1*1000))
trouble is... (2 Replies)
Discussion started by: piynik
2 Replies
LEARN ABOUT DEBIAN
httest
HTTEST(1) User Commands HTTEST(1)NAME
httest - test HTTP driven application
SYNOPSIS
httest [OPTIONS] scripts
DESCRIPTION
httest is a script based tool for testing and benchmarking web applications, web servers, proxy servers and web browsers. httest can emu-
late clients and servers in the same test script, very useful for testing proxys.
OPTIONS -V --version
Print version number and exit
-h --help
Display usage information (this message)
-n --suppress
do no print start and OK|FAILED
-s --silent
silent mode
-e --error
log level error
-w --warn
log level warn
-i --info
log level info
-d --debug
log level debug for script debugging
-p --debug-system
log level debug-system to log more details
-L --list-commands
List all available script commands
-C --help-command
Print help for specific command
-t --duration
Print test duration
-T --timestamp
Time stamp on every run
-S --shell
Shell mode
-S --shell
Shell mode
-D --define
Define variables
EXAMPLES
httest script.htt
httest -Ts script.htt
SCRIPTS
httest is script based. The following script examples can be but into a scripte i.e. sample.htt and can be called like
httest sample.htt
SIMPLE SCRIPT
Get a page and do expect return code 200 OK.
CLIENT
_REQ www.google.ch 80
__GET /search?q=apache HTTP/1.1
__Host: www.google.ch
__
_EXPECT headers "HTTP/1.1 200 OK"
_WAIT
END
CUT AND PAST SCRIPT
Cut and past from a HTTP stream, i.e we cut the apache host to access it in the second request.
CLIENT
_REQ www.google.ch 80
__GET /search?q=apache HTTP/1.1
__Host: www.google.ch
__
_MATCH body '<a href="http://([^/]*)/" class=l>Welcome! - The <em>Apache</em> HTTP Server Project' APACHE_HOST
_WAIT
_REQ $APACHE_HOST 80
__GET / HTTP/1.1
__Host: $APACHE_HOST
__
_WAIT
END
CLIENT SERVER SCRIPT
We can hold client and server in the same host. Actually multiple client and multiple server. Very useful to test forward or reverse prox-
ies. Or a webapplication which communicat itself with third party servers i.e. mail server.
This is a very basic selfcontained test you can run on any maschine.
CLIENT
_REQ localhost 8080
__GET /foo HTTP/1.1
__Host: localhost
__
_WAIT
END
SERVER 8080
_RES
_EXPECT "/foo"
_WAIT
__HTTP/1.1 200 OK
__Content-Length: AUTO
__
__Hello World
END
SSL SCRIPT
Of course SSL do also work with httest, just put "SSL:" before port.
CLIENT
_REQ localhost SSL:8080
__GET /foo HTTP/1.1
__Host: localhost
__
_WAIT
END
SERVER SSL:8080
_RES
_EXPECT "/foo"
_WAIT
__HTTP/1.1 200 OK
__Content-Length: AUTO
__
__Hello World
END
AUTHOR
Written by Christian Liesch
REPORTING BUGS
Report bugs to http://sourceforge.net/projects/htt
COPYRIGHT
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICU-
LAR PURPOSE.
httest 2.2.6 June 2012 HTTEST(1)