Jump to content
  • Advertisement
Sign in to follow this  
Ezbez

I want decimals in DrScheme!

This topic is 4235 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've just done the square root exercise, and it's working, but I'm getting answers like (sqrt 4) is 21523361/10761680. I'd like to see the decimal version of instead. How can I do this? Thanks in advanced.

Share this post


Link to post
Share on other sites
Advertisement
Scheme will by default calculate using exact arithmetics if possible. To get a decimal number you will have to explicitly force it to return it as inexact number, like this


(exact->inexact (sqrt 4))


-M

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!