I am looking for the formula for an ideal DAC: a device that takes in a digital code and returns an analog value
rfwireless-world.com claims
$$V_{out} = D\cdot V_{ref}/(2^N-1)$$
where D is the digital code and N is the resolution of the DAC.
However, sciencedirect.com claims it is
$$V_{out} = D \cdot V_{ref}/2^N$$
Which is correct? The second equation seems to imply that \$V_{out}\$ will never equal \$V_{ref}\$ since the highest value \$D\$ can take is \$D_{max} = 2^N-1\$