mirror of
https://github.com/lcn2/calc.git
synced 2025-08-16 01:03:29 +03:00
Release calc version 2.11.11
This commit is contained in:
@@ -18,8 +18,8 @@
|
||||
# received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
# @(#) $Revision: 29.15 $
|
||||
# @(#) $Id: Makefile,v 29.15 2003/01/05 08:10:56 chongo Exp $
|
||||
# @(#) $Revision: 29.16 $
|
||||
# @(#) $Id: Makefile,v 29.16 2005/12/12 06:42:30 chongo Exp $
|
||||
# @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/Makefile,v $
|
||||
#
|
||||
# Under source code control: 1991/07/21 05:00:54
|
||||
@@ -170,7 +170,7 @@ CALC_FILES= README bigprime.cal deg.cal ellip.cal lucas.cal lucas_chk.cal \
|
||||
lucas_tbl.cal mersenne.cal mod.cal pell.cal pi.cal pix.cal \
|
||||
pollard.cal poly.cal psqrt.cal quat.cal regress.cal solve.cal \
|
||||
sumsq.cal surd.cal unitfrac.cal varargs.cal chrem.cal mfactor.cal \
|
||||
bindings randmprime.cal test1700.cal randrun.cal \
|
||||
bindings randmprime.cal test1700.cal randrun.cal linear.cal \
|
||||
randbitrun.cal bernoulli.cal test2300.cal test2600.cal \
|
||||
test2700.cal test3100.cal test3300.cal test3400.cal prompt.cal \
|
||||
test3500.cal seedrandom.cal test4000.cal test4100.cal test4600.cal \
|
||||
|
12
cal/README
12
cal/README
@@ -222,6 +222,14 @@ intfile.cal
|
||||
of the integer become the last octets of the file.
|
||||
|
||||
|
||||
linear.cal
|
||||
|
||||
linear(x0, y0, x1, y1, x)
|
||||
|
||||
Returns the value y such that (x,y) in on the line (x0,y0), (x1,y1).
|
||||
Requires x0 != y0.
|
||||
|
||||
|
||||
lucas.cal
|
||||
|
||||
lucas(h, n)
|
||||
@@ -825,8 +833,8 @@ xx_print.cal
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
##
|
||||
## @(#) $Revision: 29.9 $
|
||||
## @(#) $Id: README,v 29.9 2003/01/05 08:10:56 chongo Exp $
|
||||
## @(#) $Revision: 29.10 $
|
||||
## @(#) $Id: README,v 29.10 2005/12/12 06:39:18 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/README,v $
|
||||
##
|
||||
## Under source code control: 1990/02/15 01:50:32
|
||||
|
26
cal/linear.cal
Normal file
26
cal/linear.cal
Normal file
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* linear - perform a simple two point 2D linear interpolation
|
||||
*
|
||||
* given:
|
||||
* x0, y0 first known point on the line
|
||||
* x1, y1 second knonw point on the line
|
||||
* x a given point to interpolate on
|
||||
*
|
||||
* returns:
|
||||
* y such that (x,y) is on the line defined by (x0,y0) and (x1,y1)
|
||||
*
|
||||
* NOTE: The line cannot be vertical. So x0 != y0.
|
||||
*/
|
||||
define linear(x0, y0, x1, y1, x)
|
||||
{
|
||||
/* firewall */
|
||||
if (!isnum(x0) || ! isnum(y0) || !isnum(x1) || ! isnum(y1) || !isnum(x)) {
|
||||
quit "non-numeric argument passed to linear";
|
||||
}
|
||||
if (x0 == x1) {
|
||||
quit "linear given a line with an infinite slope";
|
||||
}
|
||||
|
||||
/* return y = y0 + (delta_Y/delta_X) * (x - x0) */
|
||||
return y0 + (((y1-y0)/(x1-x0)) * (x - x0));
|
||||
}
|
Reference in New Issue
Block a user