The old Google Groups will be going away soon, but your browser is incompatible with the new version.
How to compute min and max of two mpf numbers?
 There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic. There was an error processing your request. Please try again. Standard view   View as tree
 2 messages

From:
To:
Cc:
Followup To:
Subject:
 Validation: For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon.

More options Nov 1 2012, 11:39 pm
From: Allen Rabinovich <allen...@gmail.com>
Date: Thu, 1 Nov 2012 20:39:23 -0700 (PDT)
Local: Thurs, Nov 1 2012 11:39 pm
Subject: How to compute min and max of two mpf numbers?

A beginner mpmath question here: how do I compute a min (or a max) of two
mpf numbers? Is just the regular python min(a,b) the answer? Why does that
work properly, given that mpf's are their own datatypes, and min relies on
standard comparison operators?

To post a message you must first join this group.
You do not have the permission required to post.
More options Nov 2 2012, 3:09 am
From: Fredrik Johansson <fredrik.johans...@gmail.com>
Date: Fri, 2 Nov 2012 08:09:14 +0100
Local: Fri, Nov 2 2012 3:09 am
Subject: Re: How to compute min and max of two mpf numbers?

On Fri, Nov 2, 2012 at 4:39 AM, Allen Rabinovich <allen...@gmail.com> wrote:
> A beginner mpmath question here: how do I compute a min (or a max) of two
> mpf numbers? Is just the regular python min(a,b) the answer? Why does that
> work properly, given that mpf's are their own datatypes, and min relies on
> standard comparison operators?

Yes, min(a,b) works fine. It works because mpmath classes provide
comparison methods (__ge__, __gt__, etc.) so that the standard
comparison operators (>=, >, etc.) can be used. This is standard for
custom numeric types in Python.

Fredrik