#4 extended precision $random()

open
nobody
None
5
2012-12-29
2002-06-26
Jon Willeke
No

James Self reported, in bug 227707, that V3RAND in the
MUMPS Validation Test Suite failed, because $random()
can't handle a ten-digit number. This is because
op_fnrandom() takes an int4, rather than an mval. The
attached patch is kind of a kludge that changes the
argument to an mval.

Briefly, here is what I did:

* changed int4 to mval in expritem.c, op.h, and ttt.c
* double2mval() asks sprintf() for 15 digits of precision
* op_fnrandom() uses an mval

$random() should return an error if its input is less
than 1. I haven't figured out how to do mval
comparisons, so this is incomplete.

I assert no copyright on this patch. Besides, I'm sure
there's a better way to do it.

Discussion

  • Jon Willeke
    Jon Willeke
    2002-06-26

    extended precision $random()