I wish to emulate a 32 bit environment in Python. Thus, I must make all operations occur as if they were happening on a 32 bit machine.
Example -
Take the following random calculation:
1.2229 * ((290 * (7323412.64 - 0.994 * 50)) / (1000 * (-22.9 + 273.15))) / 170
The output is: 61.04871026396052
.
Now, if I cast each argument using numpy, it turns out a bit different (each argument must be cast so no operation whatsoever will occur in the default 64 bit):
np.float32(1.2229) * ((np.float32(290) * (np.float32(7323412.64) -
np.float32(0.994) * np.float32(50))) / (np.float32(1000) *
(np.float32(-22.9) + np.float32(273.15)))) / np.float32(170)
The output is: 61.048714
Is there any way to do what I just did above in a less verbose and explicit way? Thanks.