ImageJ/Fiji macro: How to replace a pixel value in an image

I am an ImageJ/Fiji newbie. I am trying to create a very basic macro that takes an input image (either already open or input), and replace a particular value or a range (input) to another value. I know this can be done in Fiji, but only for 8bit images. However, I am trying to do this on float or 16bit images, where the dynamic range is large.
This is the code I am trying to implement.
// x = input image, [a,b]=input range
x(x<a | x>b)=0
x(x>=a & x<=b)=1
Can anyone suggest how to do this in Fiji? Thank you.

You mean with this command:
setPixel(x, y, value)
Stores value at location ( x,y ) of the current image. The screen is updated when the macro exits or call updateDisplay() to have it updated immediately.

Or, if it is a range and you want to do it in the entire image at once:

changeValues(v1, v2, v3)
Changes pixels in the image or selection that have a value in the range v1 - v2 to v3 . For example, changeValues(0,5,5) changes all pixels less than 5 to 5, and changeValues(0x0000ff,0x0000ff,0xff0000) changes all blue pixels in an RGB image to red. In ImageJ 1.52d or later, use changeValues(NaN,NaN,value) to replaces NaN values.

run("Fluorescent Cells (400K)");
changeValues(v1, v2, v3);