Data update

This commit is contained in:
Ingy döt Net 2026-02-01 16:33:20 -08:00
parent 5150844a7d
commit 4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions

View file

@ -1,33 +0,0 @@
with Ada.Text_IO;
procedure Map is
type First_Range is new Float range 0.0 .. 10.0;
type Second_Range is new Float range -1.0 .. 0.0;
function Translate (Value : First_Range) return Second_Range is
B1 : Float := Float (Second_Range'First);
B2 : Float := Float (Second_Range'Last);
A1 : Float := Float (First_Range'First);
A2 : Float := Float (First_Range'Last);
Result : Float;
begin
Result := B1 + (Float (Value) - A1) * (B2 - B1) / (A2 - A1);
return Second_Range (Result);
end;
function Translate (Value : Second_Range) return First_Range is
B1 : Float := Float (First_Range'First);
B2 : Float := Float (First_Range'Last);
A1 : Float := Float (Second_Range'First);
A2 : Float := Float (Second_Range'Last);
Result : Float;
begin
Result := B1 + (Float (Value) - A1) * (B2 - B1) / (A2 - A1);
return First_Range (Result);
end;
Test_Value : First_Range := First_Range'First;
begin
loop
Ada.Text_IO.Put_Line (First_Range'Image (Test_Value) & " maps to: "
& Second_Range'Image (Translate (Test_Value)));
exit when Test_Value = First_Range'Last;
Test_Value := Test_Value + 1.0;
end loop;
end Map;

View file

@ -1,53 +0,0 @@
IDENTIFICATION DIVISION.
PROGRAM-ID. demo-map-range.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 i USAGE FLOAT-LONG.
01 mapped-num USAGE FLOAT-LONG.
01 a-begin USAGE FLOAT-LONG VALUE 0.
01 a-end USAGE FLOAT-LONG VALUE 10.
01 b-begin USAGE FLOAT-LONG VALUE -1.
01 b-end USAGE FLOAT-LONG VALUE 0.
01 i-display PIC --9.9.
01 mapped-display PIC --9.9.
PROCEDURE DIVISION.
PERFORM VARYING i FROM 0 BY 1 UNTIL i > 10
CALL "map-range" USING CONTENT a-begin, a-end, b-begin,
b-end, i, REFERENCE mapped-num
COMPUTE i-display ROUNDED = i
COMPUTE mapped-display ROUNDED = mapped-num
DISPLAY FUNCTION TRIM(i-display) " maps to "
FUNCTION TRIM(mapped-display)
END-PERFORM
.
END PROGRAM demo-map-range.
IDENTIFICATION DIVISION.
PROGRAM-ID. map-range.
DATA DIVISION.
LINKAGE SECTION.
01 a-begin USAGE FLOAT-LONG.
01 a-end USAGE FLOAT-LONG.
01 b-begin USAGE FLOAT-LONG.
01 b-end USAGE FLOAT-LONG.
01 val-to-map USAGE FLOAT-LONG.
01 ret USAGE FLOAT-LONG.
PROCEDURE DIVISION USING a-begin, a-end, b-begin, b-end,
val-to-map, ret.
COMPUTE ret =
b-begin + ((val-to-map - a-begin) * (b-end - b-begin)
/ (a-end - a-begin))
.
END PROGRAM map-range.

View file

@ -1,5 +0,0 @@
(defun maprange (a1 a2 b1 b2 s)
(+ b1 (/ (* (- s a1) (- b2 b1)) (- a2 a1))))
(dotimes (i 10)
(message "%s" (maprange 0.0 10.0 -1.0 0.0 i)))

View file

@ -1,7 +0,0 @@
function map_range(sequence a, sequence b, atom s)
return b[1]+(s-a[1])*(b[2]-b[1])/(a[2]-a[1])
end function
for i = 0 to 10 do
printf(1, "%2g maps to %4g\n", {i, map_range({0,10},{-1,0},i)})
end for

View file

@ -1,12 +0,0 @@
include "NSLog.incl"
local fn MapRange( s as double, a1 as double, a2 as double, b1 as double, b2 as double ) as double
end fn = b1+(s-a1)*(b2-b1)/(a2-a1)
NSInteger i
for i = 0 to 10
NSLog( @"%2d maps to %5.1f", i, fn MapRange( i, 0, 10, -1, 0 ) )
next
HandleEvents

View file

@ -1,36 +0,0 @@
function Group-Range
{
[CmdletBinding()]
[OutputType([PSCustomObject])]
Param
(
[Parameter(Mandatory=$true,
Position=0)]
[ValidateCount(2,2)]
[double[]]
$Range1,
[Parameter(Mandatory=$true,
Position=1)]
[ValidateCount(2,2)]
[double[]]
$Range2,
[Parameter(Mandatory=$true,
ValueFromPipeline=$true,
Position=2)]
[double]
$Map
)
Process
{
foreach ($number in $Map)
{
[PSCustomObject]@{
Index = $number
Mapping = $Range2[0] + ($number - $Range1[0]) * ($Range2[0] - $Range2[1]) / ($Range1[0] - $Range1[1])
}
}
}
}

View file

@ -1 +0,0 @@
0..10 | Group-Range (0,10) (-1,0)

View file

@ -1,10 +0,0 @@
let map_range = ((a1, a2), (b1, b2), s) => {
b1 +. ((s -. a1) *. (b2 -. b1) /. (a2 -. a1))
}
Js.log("Mapping [0,10] to [-1,0] at intervals of 1:")
for i in 0 to 10 {
Js.log("f(" ++ Js.String.make(i) ++ ") = " ++
Js.String.make(map_range((0.0, 10.0), (-1.0, 0.0), float(i))))
}

View file

@ -1,15 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>ReScript: Map_range</title>
<meta charset="UTF-8"/>
<style rel="stylesheet" type="text/css">
body { color:#EEE; background-color:#888; }
</style>
<script>var exports = {};</script>
<script src="./maprange.js"></script>
</head>
<body>
</body>
</html>