Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A weather radar system's embedded analysis logic has been written in C. This system runs continuously to search for anomolous weather patterns. The following

A weather radar system's embedded analysis logic has been written in C. This system runs continuously to How large, in bytes, is a Vector structure? What is wrong with this code, and why is it likely causing crashes every few days?

A weather radar system's embedded analysis logic has been written in C. This system runs continuously to search for anomolous weather patterns. The following is a snippet of linear algebra code used in its analysis: struct Vector { float x; float y; float z; }; struct Vector* cross_product(struct Vector* a, struct Vector* b) { struct Vector* r = (struct Vector*) malloc(sizeof(struct Vector)); r->x = a->y*b->z - a->z*b->y; r->y = a->z*b->x a->x*b->z; r->z = a->x*b->y - a->y*b->x; return r; } float magnitude (struct Vector* v) { return sqrt (v->x*v->x + v->y*v->y + v->z*v->z); } float cross_magnitude (struct Vector* a, struct Vector* b) { return magnitude (cross_product (a,b)); } The cross_magntiude() function is used routinely to estimate the size of storm patterns. Unfortunately, the system keeps mysteriously crashing every few days like clockwork, after which it is rebooted and works fine again until the next crash. The mathematical analysts have gone over the code repeatedly -- the math is perfect. How large, in bytes, is a Vector structure? What is wrong with this code, and why is it likely causing crashes every few days?

Step by Step Solution

3.49 Rating (156 Votes )

There are 3 Steps involved in it

Step: 1

The Vector structure appears to have three float variables x y and z In C the size of a ... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction To Management Science A Modeling And Cases Studies Approach With Spreadsheets

Authors: Frederick S. Hillier, Mark S. Hillier

5th Edition

978-0077825560, 78024064, 9780077498948, 007782556X, 77498941, 978-0078024061

More Books

Students also viewed these Operating System questions

Question

1 Define internal control.

Answered: 1 week ago

Question

Data Set 123456789 Print Done

Answered: 1 week ago