Post Scarcity
A prototype for a post scarcity programming environment
Loading...
Searching...
No Matches
ratio.h
Go to the documentation of this file.
1/**
2 * ratio.h
3 *
4 * functions for rational number cells.
5 *
6 *
7 * (c) 2017 Simon Brooke <simon@journeyman.cc>
8 * Licensed under GPL version 2.0, or, at your option, any later version.
9 */
10
11#ifndef __ratio_h
12#define __ratio_h
13
14struct cons_pointer simplify_ratio( struct cons_pointer arg );
15
16struct cons_pointer add_ratio_ratio( struct cons_pointer arg1,
17 struct cons_pointer arg2 );
18
19struct cons_pointer add_integer_ratio( struct cons_pointer intarg,
20 struct cons_pointer ratarg );
21
23 struct cons_pointer arg2 );
24
25struct cons_pointer multiply_ratio_ratio( struct cons_pointer arg1, struct
26 cons_pointer arg2 );
27
29 struct cons_pointer ratarg );
30
32 struct cons_pointer arg2 );
33
34struct cons_pointer make_ratio( struct cons_pointer dividend,
35 struct cons_pointer divisor,
36 bool simplify );
37
38bool equal_ratio_ratio( struct cons_pointer a, struct cons_pointer b );
39
40long double c_ratio_to_ld( struct cons_pointer rat );
41
42#endif
An indirect pointer to a cons cell.
struct cons_pointer simplify_ratio(struct cons_pointer arg)
ratio.h
Definition ratio.c:48
long double c_ratio_to_ld(struct cons_pointer rat)
convert a ratio to an equivalent long double.
Definition ratio.c:379
struct cons_pointer add_ratio_ratio(struct cons_pointer arg1, struct cons_pointer arg2)
return a cons_pointer indicating a number which is the sum of the ratios indicated by arg1 and arg2.
Definition ratio.c:93
struct cons_pointer multiply_ratio_ratio(struct cons_pointer arg1, struct cons_pointer arg2)
return a cons_pointer indicating a number which is the product of the ratios indicated by arg1 and ar...
Definition ratio.c:203
bool equal_ratio_ratio(struct cons_pointer a, struct cons_pointer b)
True if a and be are identical rationals, else false.
Definition ratio.c:357
struct cons_pointer divide_ratio_ratio(struct cons_pointer arg1, struct cons_pointer arg2)
return a cons_pointer to a ratio which represents the value of the ratio indicated by arg1 divided by...
Definition ratio.c:176
struct cons_pointer multiply_integer_ratio(struct cons_pointer intarg, struct cons_pointer ratarg)
return a cons_pointer indicating a number which is the product of the intger indicated by intarg and ...
Definition ratio.c:254
struct cons_pointer add_integer_ratio(struct cons_pointer intarg, struct cons_pointer ratarg)
return a cons_pointer indicating a number which is the sum of the intger indicated by intarg and the ...
Definition ratio.c:137
struct cons_pointer subtract_ratio_ratio(struct cons_pointer arg1, struct cons_pointer arg2)
return a cons_pointer indicating a number which is the difference of the ratios indicated by arg1 and...
Definition ratio.c:290
struct cons_pointer make_ratio(struct cons_pointer dividend, struct cons_pointer divisor, bool simplify)
Construct a ratio frame from this dividend and divisor, expected to be integers, in the context of th...
Definition ratio.c:312