# 2019q1 第 13 週測驗題 --- ### 測驗 `1` 考慮到以下浮點數除法程式: (fdiv.c) ```cpp #include <stdio.h> #include <stdlib.h> double divop(double orig, int slots) { if (slots == 1 || orig == 0) return orig; int od = slots & 1; double result = divop(orig / D1, od ? (slots + D2) >> 1 : slots >> 1); if (od) result += divop(result, slots); return result; } ``` 假設 `divop()` 的第二個參數必為大於 `0` 的整數,而且不超過 `int` 型態能表達的數值上界。請補完程式碼。 ==作答區== `D1` = ? * `(a)` 1 * `(b)` 2 * `(c)` 3 * `(d)` 4 `D2` = ? * `(a)` 1 * `(b)` 2 * `(c)` 3 * `(d)` 4
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up