Sign in to follow this  

I want decimals in DrScheme!

This topic is 4049 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
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

This topic is 4049 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this