Changeset View
Changeset View
Standalone View
Standalone View
lib/libc/gen/erand48.c
| Show All 10 Lines | |||||
| * to anyone/anything when using this software. | * to anyone/anything when using this software. | ||||
| */ | */ | ||||
| #include "rand48.h" | #include "rand48.h" | ||||
| double | double | ||||
| erand48(unsigned short xseed[3]) | erand48(unsigned short xseed[3]) | ||||
| { | { | ||||
| _dorand48(xseed); | uint48 tmp; | ||||
| return ldexp((double) xseed[0], -48) + | |||||
| ldexp((double) xseed[1], -32) + | ERAND48_BEGIN; | ||||
| ldexp((double) xseed[2], -16); | DORAND48(tmp, xseed); | ||||
| ERAND48_END(tmp); | |||||
| } | } | ||||