caml-list - the Caml user's mailing list
 help / Atom feed
* [Caml-list] unsubscribe
@ 2020-11-25 18:31 Hunter
  0 siblings, 0 replies; 20+ messages in thread
From: Hunter @ 2020-11-25 18:31 UTC (permalink / raw)
  To: caml-list

[-- Attachment #1: Type: text/plain, Size: 1 bytes --]



[-- Attachment #2: Type: text/html, Size: 26 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread
* [Caml-list] unsubscribe
@ 2020-12-18 16:12 Hunter
  0 siblings, 0 replies; 20+ messages in thread
From: Hunter @ 2020-12-18 16:12 UTC (permalink / raw)
  To: caml-list

[-- Attachment #1: Type: text/plain, Size: 12 bytes --]

unsubscribe

[-- Attachment #2: Type: text/html, Size: 33 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread
* [Caml-list]  unsubscribe
@ 2020-12-18 20:15 Alexei
  0 siblings, 0 replies; 20+ messages in thread
From: Alexei @ 2020-12-18 20:15 UTC (permalink / raw)
  To: caml-list

[-- Attachment #1: Type: text/plain, Size: 12 bytes --]

unsubscribe

[-- Attachment #2: Type: text/html, Size: 90 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread
* [Caml-list] unsubscribe
@ 2021-01-04 16:45 Adam Johnson
  2021-01-04 16:58 ` Van Chan Ngo
  0 siblings, 1 reply; 20+ messages in thread
From: Adam Johnson @ 2021-01-04 16:45 UTC (permalink / raw)
  To: caml-list

[-- Attachment #1: Type: text/plain, Size: 11 bytes --]

unsubscribe

[-- Attachment #2: Type: text/html, Size: 44 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread
* [Caml-list] unsubscribe
@ 2021-04-11 18:31 jean-denis eiden
  0 siblings, 0 replies; 20+ messages in thread
From: jean-denis eiden @ 2021-04-11 18:31 UTC (permalink / raw)
  To: caml-list

unsubscribe

^ permalink raw reply	[flat|nested] 20+ messages in thread
* [Caml-list] unsubscribe
@ 2021-05-26 13:13 Dan Frumin
  0 siblings, 0 replies; 20+ messages in thread
From: Dan Frumin @ 2021-05-26 13:13 UTC (permalink / raw)
  To: caml-list




^ permalink raw reply	[flat|nested] 20+ messages in thread
* [Caml-list] unsubscribe
@ 2021-09-17 11:34 jean-denis eiden
  0 siblings, 0 replies; 20+ messages in thread
From: jean-denis eiden @ 2021-09-17 11:34 UTC (permalink / raw)
  To: caml-list

unsubscribe

^ permalink raw reply	[flat|nested] 20+ messages in thread
* [Caml-list] unsubscribe
@ 2021-11-01 13:11 Bryan Starbuck
  0 siblings, 0 replies; 20+ messages in thread
From: Bryan Starbuck @ 2021-11-01 13:11 UTC (permalink / raw)
  To: caml-list

[-- Attachment #1: Type: text/plain, Size: 11 bytes --]

unsubscribe

[-- Attachment #2: Type: text/html, Size: 440 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread
* [Caml-list] unsubscribe
@ 2022-06-09  4:32 daniel Ding
  0 siblings, 0 replies; 20+ messages in thread
From: daniel Ding @ 2022-06-09  4:32 UTC (permalink / raw)
  To: caml-list

[-- Attachment #1: Type: text/plain, Size: 12 bytes --]

unsubscribe

[-- Attachment #2: Type: text/html, Size: 133 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread
* [Caml-list] unsubscribe
@ 2022-06-10 15:15 Gustave Nimant
  0 siblings, 0 replies; 20+ messages in thread
From: Gustave Nimant @ 2022-06-10 15:15 UTC (permalink / raw)
  To: caml-list

unsubscribe


^ permalink raw reply	[flat|nested] 20+ messages in thread
* Re: [Caml-list] string_of_float (0.1 +. 0.2)
@ 2022-06-16  6:24 Oleg
  2022-06-16  9:01 ` Andreas Rossberg
  0 siblings, 1 reply; 20+ messages in thread
From: Oleg @ 2022-06-16  6:24 UTC (permalink / raw)
  To: asai; +Cc: caml-list


Actually the similar problem of accurately conveying floats also
occurs in MetaOCaml/Code generation. After all, what you are doing is
a sort of reflection.

First of all, accurate (lossless) printing of floats is a research
area in itself. The latest result is

  http://www.cs.tufts.edu/~nr/cs257/archive/florian-loitsch/printf.pdf
  https://github.com/google/double-conversion

Perhaps some day it can be incorporated in OCaml, so that
string_of_float truly returns *the* printable representation of a float.

Hexademical printout (which is also supported in C) 
mentioned by Daniel Buenzli is another way -- provided we don't
actually have to look at the printed value, because we probably won't
understand it anyway.

In practice in our recent project, we settled on

let float : float -> float cde = fun x ->
  let str = if Float.is_integer x then string_of_float x else
            Printf.sprintf "%.17g" x

which seems to work well. At least, it solved the problems when the
results of our generated signal processing code differed slightly from
the results of the hand-written reference C code, due to slightly
different printed FP values in FP array initializers (filter
coefficients). We used to use string_of_float back then. With the
above float, the problem is solved.

I have to add that float above does not account for NaN, plus/minus
infinity and -0. So, the fully production code also has to add these
cases.


^ permalink raw reply	[flat|nested] 20+ messages in thread
* [Caml-list] unsubscribe
@ 2022-06-16 12:57 Gustave Nimant
  0 siblings, 0 replies; 20+ messages in thread
From: Gustave Nimant @ 2022-06-16 12:57 UTC (permalink / raw)
  To: caml-list

unsubscribe


^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, back to index

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-25 18:31 [Caml-list] unsubscribe Hunter
2020-12-18 16:12 Hunter
2020-12-18 20:15 Alexei
2021-01-04 16:45 Adam Johnson
2021-01-04 16:58 ` Van Chan Ngo
2021-01-04 17:28   ` Yawar Amin
2021-01-04 18:33     ` Xavier Leroy
2021-01-04 19:42       ` Yawar Amin
2021-01-04 19:52         ` Daniil Baturin
2021-01-04 20:05           ` Yawar Amin
2021-01-04 21:08         ` Philippe Wang
2021-01-04 21:26           ` Yawar Amin
2021-04-11 18:31 jean-denis eiden
2021-05-26 13:13 Dan Frumin
2021-09-17 11:34 jean-denis eiden
2021-11-01 13:11 Bryan Starbuck
2022-06-09  4:32 daniel Ding
2022-06-10 15:15 Gustave Nimant
2022-06-16  6:24 [Caml-list] string_of_float (0.1 +. 0.2) Oleg
2022-06-16  9:01 ` Andreas Rossberg
2022-06-16  9:14   ` [Caml-list] unsubscribe Jean-Denis EIDEN JEAN-DENIS
2022-06-16 12:57 Gustave Nimant

caml-list - the Caml user's mailing list

Archives are clonable: git clone --mirror https://inbox.ocaml.org/caml-list

AGPL code for this site: git clone https://public-inbox.org/ public-inbox