mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-15 08:47:35 +02:00
Cleanup
This commit is contained in:
parent
68adb4c611
commit
d99d4a9459
1 changed files with 11 additions and 4 deletions
15
runtime.c
15
runtime.c
|
@ -8389,10 +8389,12 @@ void init_polyfills(void)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: rename this and integrate with corresponding functions in (scheme base)
|
/**
|
||||||
// WIP - testing numerator/denominator computation
|
* Code from https://stackoverflow.com/a/51142807/101258
|
||||||
// Code from https://stackoverflow.com/a/51142807/101258
|
* to take a double and compute its numerator and denominator,
|
||||||
// Return error flag
|
* which are returned using the given pointers.
|
||||||
|
* An error flag is directly returned.
|
||||||
|
*/
|
||||||
int num2ratio(double x, double *numerator, double *denominator) {
|
int num2ratio(double x, double *numerator, double *denominator) {
|
||||||
if (!isfinite(x)) {
|
if (!isfinite(x)) {
|
||||||
*numerator = *denominator = 0.0;
|
*numerator = *denominator = 0.0;
|
||||||
|
@ -8426,6 +8428,11 @@ int num2ratio(double x, double *numerator, double *denominator) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Receive a Scheme number and pass requested portion of a rational number to
|
||||||
|
* the continuation `cont`. Pass numerator if `numerator` is true, else the
|
||||||
|
* denominator is passed.
|
||||||
|
*/
|
||||||
void Cyc_get_ratio(void *data, object cont, object n, int numerator)
|
void Cyc_get_ratio(void *data, object cont, object n, int numerator)
|
||||||
{
|
{
|
||||||
double d = 0.0;
|
double d = 0.0;
|
||||||
|
|
Loading…
Add table
Reference in a new issue