Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3968252
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T03:49:11+00:00 2026-05-20T03:49:11+00:00

While thinking about the way to implement Scheme R5RS, I have become puzzled about

  • 0

While thinking about the way to implement Scheme R5RS, I have become puzzled about the following extract of R5RS (pages 22-23):

(remainder -13 -4) ==> -1
(remainder -13 -4.0) ==> -1.0 ; inexact

(lcm 32 -36) ==> 288
(lcm 32.0 -36) ==> 288.0 ; inexact

(denominator (/ 6 4)) ==> 2
(denominator (exact->inexact (/ 6 4))) ==> 2.0

Should we understand that, even if -4.0, 32.0 and (exact->inexact (/ 6 4)) are inexact, the implementation shall “remember” their exact equivalent (-4, 32 and 3/2) in order to proceed to integer division, prime factors decomposition, etc?

Otherwise, how could the implementation succeed in giving the above answers?

Thanks in advance for any light you could throw on this subject! 🙂

Nicolas

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T03:49:12+00:00Added an answer on May 20, 2026 at 3:49 am

    There is no need for the implementation to remember the exact equivalent because as per R5RS it is OK to produce an inexact result given an operation involves an inexact operand. E.g:

    > (+ -1.0 2)
    => 1.0
    

    Internally, the interpreter can upgrade 2 to a float and call the addition operation for floats, there is no need to remember anything:

    /* Assuming that the interpreter implements primitive operations in C. */
    SchemeObject* addInts(SchemeObject* a, SchemeObject* b)
    {
        if (a->type == FLOAT || b->type == FLOAT)
        {
            cast_int_value_to_float (a);
            cast_int_value_to_float (b);
            return addFloats (a, b);
        }
        return make_new_int_object (get_int_value (a) + get_int_value (b));
     }
    

    In effect, the above addition in Scheme is treated by the interpreter as:

    > (+ -1.0 2.0)
    => 1.0   
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been thinking about this problem for a while and have yet to come
While thinking about this question and conversing with the participants, the idea came up
I've been thinking about this object oriented design question for a while now and
Having read Fowler's Refactoring for a while, I still often catch myself thinking I
While going through university and from following the development of SO, I've heard a
While the C# spec does include a pre-processor and basic directives (#define, #if, etc),
While I've seen rare cases where private inheritance was needed, I've never encountered a
While setting up CruiseControl, I added a buildpublisher block to the publisher tasks: <buildpublisher>
While working in a Java app, I recently needed to assemble a comma-delimited list
While in the final throws of upgrading MS-SQL Server 2005 Express Edition to MS-SQL

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.