Jump to content

Bernstein basis polynomials: Difference between revisions

Added more explanation of the type-safety design: why what C/Pascal/C++/etc. do is inadequate.
(I thought better of including the side note.)
Tag: Manual revert
(Added more explanation of the type-safety design: why what C/Pascal/C++/etc. do is inadequate.)
Line 563:
 
(* Some macros that are convenient for type-safe floating point
without actually knowing which floating-point type it will be. These
be. These macros will work if, in the context where they appear, the
the typechecker can infer which floating-point type is meant. *)
macdef one_third = g0i2f 1 / g0i2f 3
macdef one_half = g0i2f 1 / g0i2f 2
Line 572:
(* We will try to achieve the type-safety of distinguishing between
monomial and Bernstein bases at compile time, but without overhead
at runtime. *)(As much type-safety as we achieve here can be done in
many other languages simply by giving the types different names but
the same fields. But then you cannot easily have type-safe
subprograms that work on EITHER type. Perhaps you could do it with
a type hierarchy, but then you start getting runtime overhead.) *)
tkindef monoknd = "rosettacode_monomial_poly"
tkindef bernknd = "rosettacode_bernstein_poly"
1,448

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.