From 2612f47f558e9201f0aeaf7655661574066e0243 Mon Sep 17 00:00:00 2001 From: Aaron Taylor Date: Fri, 12 Jul 2019 19:01:31 -0700 Subject: [PATCH] Added random number generator to VVS stdlib. --- stdlib/README.md | 1 + stdlib/math.pvvs | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/stdlib/README.md b/stdlib/README.md index 3bff980..ee4670b 100644 --- a/stdlib/README.md +++ b/stdlib/README.md @@ -31,6 +31,7 @@ header comment for each function to learn the call and return stack. 1001 ----- print string from heap (stdio.pvvs) 1010 ----- print number from stack (stdio.pvvs) 010xxx - math functions + 10000 ----- random (math.pvvs) 10001 ----- absolute value (math.pvvs) 011xxx - unassigned 100xxx - unassigned diff --git a/stdlib/math.pvvs b/stdlib/math.pvvs index b1a6c0e..0df09ed 100644 --- a/stdlib/math.pvvs +++ b/stdlib/math.pvvs @@ -1,6 +1,18 @@ #ifndef VVS_STDLIB_MATH #define VVS_STDLIB_MATH +@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ +@ Description: +@ This function returns a random IEEE-vetted number per RFC 1149.5. +@ Call Stack: +@ empty +@ Return Stack: +@ random number <-- TOS +@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ +NSSVTSSSSN | Mark: 10000 (random) +SSSTSSN | PUSH +4 +NTN | RTS + @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ Description: @ This function returns the absolute value of its argument -- 2.20.1