| 1 | module scheme |
| 2 | |
| 3 | const flonum_native_descriptors = [ |
| 4 | NativeDescriptor{'flonum?', arithmetic_flonum_flonump}, |
| 5 | NativeDescriptor{'real->flonum', arithmetic_flonum_real_to_flonum}, |
| 6 | NativeDescriptor{'fl=?', arithmetic_flonum_eq}, |
| 7 | NativeDescriptor{'fl<?', arithmetic_flonum_lt}, |
| 8 | NativeDescriptor{'fl<=?', arithmetic_flonum_le}, |
| 9 | NativeDescriptor{'fl>?', arithmetic_flonum_gt}, |
| 10 | NativeDescriptor{'fl>=?', arithmetic_flonum_ge}, |
| 11 | NativeDescriptor{'flinteger?', arithmetic_flonum_integerp}, |
| 12 | NativeDescriptor{'flzero?', arithmetic_flonum_zerop}, |
| 13 | NativeDescriptor{'flpositive?', arithmetic_flonum_positivep}, |
| 14 | NativeDescriptor{'flnegative?', arithmetic_flonum_negativep}, |
| 15 | NativeDescriptor{'flodd?', arithmetic_flonum_oddp}, |
| 16 | NativeDescriptor{'fleven?', arithmetic_flonum_evenp}, |
| 17 | NativeDescriptor{'flfinite?', arithmetic_flonum_finitep}, |
| 18 | NativeDescriptor{'flinfinite?', arithmetic_flonum_infinitep}, |
| 19 | NativeDescriptor{'flnan?', arithmetic_flonum_nanp}, |
| 20 | NativeDescriptor{'flmax', arithmetic_flonum_max}, |
| 21 | NativeDescriptor{'flmin', arithmetic_flonum_min}, |
| 22 | NativeDescriptor{'fl+', arithmetic_flonum_add}, |
| 23 | NativeDescriptor{'fl*', arithmetic_flonum_multiply}, |
| 24 | NativeDescriptor{'fl-', arithmetic_flonum_subtract}, |
| 25 | NativeDescriptor{'fl/', arithmetic_flonum_divide}, |
| 26 | NativeDescriptor{'flabs', arithmetic_flonum_abs}, |
| 27 | NativeDescriptor{'fldiv-and-mod', arithmetic_flonum_div_and_mod}, |
| 28 | NativeDescriptor{'fldiv', arithmetic_flonum_div}, |
| 29 | NativeDescriptor{'flmod', arithmetic_flonum_mod}, |
| 30 | NativeDescriptor{'fldiv0-and-mod0', arithmetic_flonum_div0_and_mod0}, |
| 31 | NativeDescriptor{'fldiv0', arithmetic_flonum_div0}, |
| 32 | NativeDescriptor{'flmod0', arithmetic_flonum_mod0}, |
| 33 | NativeDescriptor{'flnumerator', arithmetic_flonum_numerator}, |
| 34 | NativeDescriptor{'fldenominator', arithmetic_flonum_denominator}, |
| 35 | NativeDescriptor{'flfloor', arithmetic_flonum_floor}, |
| 36 | NativeDescriptor{'flceiling', arithmetic_flonum_ceiling}, |
| 37 | NativeDescriptor{'fltruncate', arithmetic_flonum_truncate}, |
| 38 | NativeDescriptor{'flround', arithmetic_flonum_round}, |
| 39 | NativeDescriptor{'flexp', arithmetic_flonum_exp}, |
| 40 | NativeDescriptor{'fllog', arithmetic_flonum_log}, |
| 41 | NativeDescriptor{'flsin', arithmetic_flonum_sin}, |
| 42 | NativeDescriptor{'flcos', arithmetic_flonum_cos}, |
| 43 | NativeDescriptor{'fltan', arithmetic_flonum_tan}, |
| 44 | NativeDescriptor{'flasin', arithmetic_flonum_asin}, |
| 45 | NativeDescriptor{'flacos', arithmetic_flonum_acos}, |
| 46 | NativeDescriptor{'flatan', arithmetic_flonum_atan}, |
| 47 | NativeDescriptor{'flsqrt', arithmetic_flonum_sqrt}, |
| 48 | NativeDescriptor{'flexpt', arithmetic_flonum_expt}, |
| 49 | NativeDescriptor{'fixnum->flonum', arithmetic_flonum_fixnum_to_flonum}, |
| 50 | ]! |
| 51 | |
| 52 | enum FlonumOperation { |
| 53 | flonump |
| 54 | real_to_flonum |
| 55 | eq |
| 56 | lt |
| 57 | le |
| 58 | gt |
| 59 | ge |
| 60 | integerp |
| 61 | zerop |
| 62 | positivep |
| 63 | negativep |
| 64 | oddp |
| 65 | evenp |
| 66 | finitep |
| 67 | infinitep |
| 68 | nanp |
| 69 | max |
| 70 | min |
| 71 | add |
| 72 | multiply |
| 73 | subtract |
| 74 | divide |
| 75 | abs |
| 76 | div_and_mod |
| 77 | div |
| 78 | mod |
| 79 | div0_and_mod0 |
| 80 | div0 |
| 81 | mod0 |
| 82 | numerator |
| 83 | denominator |
| 84 | floor |
| 85 | ceiling |
| 86 | truncate |
| 87 | round |
| 88 | exp |
| 89 | log |
| 90 | sin |
| 91 | cos |
| 92 | tan |
| 93 | asin |
| 94 | acos |
| 95 | atan |
| 96 | sqrt |
| 97 | expt |
| 98 | fixnum_to_flonum |
| 99 | } |
| 100 | |
| 101 | fn arithmetic_flonum_flonump(mut _vm VM, args []Value) !Value { return flonum_call(.flonump, args) } |
| 102 | |
| 103 | fn arithmetic_flonum_real_to_flonum(mut _vm VM, args []Value) !Value { |
| 104 | return flonum_call(.real_to_flonum, args) |
| 105 | } |
| 106 | |
| 107 | fn arithmetic_flonum_eq(mut _vm VM, args []Value) !Value { return flonum_call(.eq, args) } |
| 108 | |
| 109 | fn arithmetic_flonum_lt(mut _vm VM, args []Value) !Value { return flonum_call(.lt, args) } |
| 110 | |
| 111 | fn arithmetic_flonum_le(mut _vm VM, args []Value) !Value { return flonum_call(.le, args) } |
| 112 | |
| 113 | fn arithmetic_flonum_gt(mut _vm VM, args []Value) !Value { return flonum_call(.gt, args) } |
| 114 | |
| 115 | fn arithmetic_flonum_ge(mut _vm VM, args []Value) !Value { return flonum_call(.ge, args) } |
| 116 | |
| 117 | fn arithmetic_flonum_integerp(mut _vm VM, args []Value) !Value { |
| 118 | return flonum_call(.integerp, args) |
| 119 | } |
| 120 | |
| 121 | fn arithmetic_flonum_zerop(mut _vm VM, args []Value) !Value { return flonum_call(.zerop, args) } |
| 122 | |
| 123 | fn arithmetic_flonum_positivep(mut _vm VM, args []Value) !Value { |
| 124 | return flonum_call(.positivep, args) |
| 125 | } |
| 126 | |
| 127 | fn arithmetic_flonum_negativep(mut _vm VM, args []Value) !Value { |
| 128 | return flonum_call(.negativep, args) |
| 129 | } |
| 130 | |
| 131 | fn arithmetic_flonum_oddp(mut _vm VM, args []Value) !Value { return flonum_call(.oddp, args) } |
| 132 | |
| 133 | fn arithmetic_flonum_evenp(mut _vm VM, args []Value) !Value { return flonum_call(.evenp, args) } |
| 134 | |
| 135 | fn arithmetic_flonum_finitep(mut _vm VM, args []Value) !Value { return flonum_call(.finitep, args) } |
| 136 | |
| 137 | fn arithmetic_flonum_infinitep(mut _vm VM, args []Value) !Value { |
| 138 | return flonum_call(.infinitep, args) |
| 139 | } |
| 140 | |
| 141 | fn arithmetic_flonum_nanp(mut _vm VM, args []Value) !Value { return flonum_call(.nanp, args) } |
| 142 | |
| 143 | fn arithmetic_flonum_max(mut _vm VM, args []Value) !Value { return flonum_call(.max, args) } |
| 144 | |
| 145 | fn arithmetic_flonum_min(mut _vm VM, args []Value) !Value { return flonum_call(.min, args) } |
| 146 | |
| 147 | fn arithmetic_flonum_add(mut _vm VM, args []Value) !Value { return flonum_call(.add, args) } |
| 148 | |
| 149 | fn arithmetic_flonum_multiply(mut _vm VM, args []Value) !Value { |
| 150 | return flonum_call(.multiply, args) |
| 151 | } |
| 152 | |
| 153 | fn arithmetic_flonum_subtract(mut _vm VM, args []Value) !Value { |
| 154 | return flonum_call(.subtract, args) |
| 155 | } |
| 156 | |
| 157 | fn arithmetic_flonum_divide(mut _vm VM, args []Value) !Value { return flonum_call(.divide, args) } |
| 158 | |
| 159 | fn arithmetic_flonum_abs(mut _vm VM, args []Value) !Value { return flonum_call(.abs, args) } |
| 160 | |
| 161 | fn arithmetic_flonum_div_and_mod(mut _vm VM, args []Value) !Value { |
| 162 | return flonum_call(.div_and_mod, args) |
| 163 | } |
| 164 | |
| 165 | fn arithmetic_flonum_div(mut _vm VM, args []Value) !Value { return flonum_call(.div, args) } |
| 166 | |
| 167 | fn arithmetic_flonum_mod(mut _vm VM, args []Value) !Value { return flonum_call(.mod, args) } |
| 168 | |
| 169 | fn arithmetic_flonum_div0_and_mod0(mut _vm VM, args []Value) !Value { |
| 170 | return flonum_call(.div0_and_mod0, args) |
| 171 | } |
| 172 | |
| 173 | fn arithmetic_flonum_div0(mut _vm VM, args []Value) !Value { return flonum_call(.div0, args) } |
| 174 | |
| 175 | fn arithmetic_flonum_mod0(mut _vm VM, args []Value) !Value { return flonum_call(.mod0, args) } |
| 176 | |
| 177 | fn arithmetic_flonum_numerator(mut _vm VM, args []Value) !Value { |
| 178 | return flonum_call(.numerator, args) |
| 179 | } |
| 180 | |
| 181 | fn arithmetic_flonum_denominator(mut _vm VM, args []Value) !Value { |
| 182 | return flonum_call(.denominator, args) |
| 183 | } |
| 184 | |
| 185 | fn arithmetic_flonum_floor(mut _vm VM, args []Value) !Value { return flonum_call(.floor, args) } |
| 186 | |
| 187 | fn arithmetic_flonum_ceiling(mut _vm VM, args []Value) !Value { return flonum_call(.ceiling, args) } |
| 188 | |
| 189 | fn arithmetic_flonum_truncate(mut _vm VM, args []Value) !Value { |
| 190 | return flonum_call(.truncate, args) |
| 191 | } |
| 192 | |
| 193 | fn arithmetic_flonum_round(mut _vm VM, args []Value) !Value { return flonum_call(.round, args) } |
| 194 | |
| 195 | fn arithmetic_flonum_exp(mut _vm VM, args []Value) !Value { return flonum_call(.exp, args) } |
| 196 | |
| 197 | fn arithmetic_flonum_log(mut _vm VM, args []Value) !Value { return flonum_call(.log, args) } |
| 198 | |
| 199 | fn arithmetic_flonum_sin(mut _vm VM, args []Value) !Value { return flonum_call(.sin, args) } |
| 200 | |
| 201 | fn arithmetic_flonum_cos(mut _vm VM, args []Value) !Value { return flonum_call(.cos, args) } |
| 202 | |
| 203 | fn arithmetic_flonum_tan(mut _vm VM, args []Value) !Value { return flonum_call(.tan, args) } |
| 204 | |
| 205 | fn arithmetic_flonum_asin(mut _vm VM, args []Value) !Value { return flonum_call(.asin, args) } |
| 206 | |
| 207 | fn arithmetic_flonum_acos(mut _vm VM, args []Value) !Value { return flonum_call(.acos, args) } |
| 208 | |
| 209 | fn arithmetic_flonum_atan(mut _vm VM, args []Value) !Value { return flonum_call(.atan, args) } |
| 210 | |
| 211 | fn arithmetic_flonum_sqrt(mut _vm VM, args []Value) !Value { return flonum_call(.sqrt, args) } |
| 212 | |
| 213 | fn arithmetic_flonum_expt(mut _vm VM, args []Value) !Value { return flonum_call(.expt, args) } |
| 214 | |
| 215 | fn arithmetic_flonum_fixnum_to_flonum(mut _vm VM, args []Value) !Value { |
| 216 | return flonum_call(.fixnum_to_flonum, args) |
| 217 | } |
| 218 | |