Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <msp430.h>
- #include <stdint.h>
- uint16_t WhatAmIDoing (uint16_t E) {
- volatile uint16_t F;
- volatile uint16_t G;
- volatile int16_t counter = 0;
- F = E;
- G = (F + (E / F)) / 2;
- while ((F - G) >= 1) {
- counter = counter + 1;
- F = G;
- G = (F + (E / F)) / 2;
- }
- return G;
- }
- void main(void) {
- WDTCTL = WDTPW | WDTHOLD;
- volatile uint16_t in = 65000;
- volatile uint16_t out = 0;
- while(1){
- out = WhatAmIDoing (in);
- }
- }
- https://cs.wikipedia.org/wiki/Babyl%C3%B3nsk%C3%A1_metoda
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement